Home | History | Annotate | Download | only in shell
      1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
      2 // Use of this source code is governed by a BSD-style license that can be
      3 // found in the LICENSE file.
      4 
      5 #ifndef CONTENT_SHELL_SHELL_DEVTOOLS_FRONTEND_H_
      6 #define CONTENT_SHELL_SHELL_DEVTOOLS_FRONTEND_H_
      7 
      8 #include "base/basictypes.h"
      9 #include "base/compiler_specific.h"
     10 #include "base/memory/ref_counted.h"
     11 #include "base/memory/scoped_ptr.h"
     12 #include "content/public/browser/devtools_agent_host.h"
     13 #include "content/public/browser/devtools_client_host.h"
     14 #include "content/public/browser/devtools_frontend_host_delegate.h"
     15 #include "content/public/browser/web_contents_observer.h"
     16 
     17 namespace content {
     18 
     19 class RenderViewHost;
     20 class Shell;
     21 class WebContents;
     22 
     23 class ShellDevToolsFrontend : public WebContentsObserver,
     24                               public DevToolsFrontendHostDelegate {
     25  public:
     26   static ShellDevToolsFrontend* Show(WebContents* inspected_contents);
     27   void Focus();
     28   void Close();
     29 
     30   Shell* frontend_shell() const { return frontend_shell_; }
     31 
     32  private:
     33   ShellDevToolsFrontend(Shell* frontend_shell, DevToolsAgentHost* agent_host);
     34   virtual ~ShellDevToolsFrontend();
     35 
     36   // WebContentsObserver overrides
     37   virtual void RenderViewCreated(RenderViewHost* render_view_host) OVERRIDE;
     38   virtual void WebContentsDestroyed(WebContents* web_contents) OVERRIDE;
     39 
     40   // DevToolsFrontendHostDelegate implementation
     41   virtual void ActivateWindow() OVERRIDE {}
     42   virtual void ChangeAttachedWindowHeight(unsigned height) OVERRIDE {}
     43   virtual void CloseWindow() OVERRIDE {}
     44   virtual void MoveWindow(int x, int y) OVERRIDE {}
     45   virtual void SetDockSide(const std::string& side) OVERRIDE {}
     46   virtual void OpenInNewTab(const std::string& url) OVERRIDE {}
     47   virtual void SaveToFile(const std::string& url,
     48                           const std::string& content,
     49                           bool save_as) OVERRIDE {}
     50   virtual void AppendToFile(const std::string& url,
     51                             const std::string& content) OVERRIDE {}
     52   virtual void RequestFileSystems() OVERRIDE {}
     53   virtual void AddFileSystem() OVERRIDE {}
     54   virtual void RemoveFileSystem(const std::string& file_system_path) OVERRIDE {}
     55   virtual void IndexPath(int request_id,
     56                          const std::string& file_system_path) OVERRIDE {}
     57   virtual void StopIndexing(int request_id) OVERRIDE {}
     58   virtual void SearchInPath(int request_id,
     59                             const std::string& file_system_path,
     60                             const std::string& query) OVERRIDE {}
     61 
     62   virtual void InspectedContentsClosing() OVERRIDE;
     63 
     64   Shell* frontend_shell_;
     65   scoped_refptr<DevToolsAgentHost> agent_host_;
     66   scoped_ptr<DevToolsClientHost> frontend_host_;
     67 
     68   DISALLOW_COPY_AND_ASSIGN(ShellDevToolsFrontend);
     69 };
     70 
     71 }  // namespace content
     72 
     73 #endif  // CONTENT_SHELL_SHELL_DEVTOOLS_FRONTEND_H_
     74