Upstream version 5.34.104.0
[platform/framework/web/crosswalk.git] / src / content / shell / browser / shell_devtools_frontend.h
1 // Copyright 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_BROWSER_SHELL_DEVTOOLS_FRONTEND_H_
6 #define CONTENT_SHELL_BROWSER_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 GURL GetDevToolsPathAsURL(const std::string& settings);
20
21 class RenderViewHost;
22 class Shell;
23 class WebContents;
24
25 class ShellDevToolsFrontend : public WebContentsObserver,
26                               public DevToolsFrontendHostDelegate {
27  public:
28   static ShellDevToolsFrontend* Show(WebContents* inspected_contents);
29   static ShellDevToolsFrontend* Show(WebContents* inspected_contents,
30                                      const std::string& settings);
31   void Activate();
32   void Focus();
33   void InspectElementAt(int x, int y);
34   void Close();
35
36   Shell* frontend_shell() const { return frontend_shell_; }
37
38  private:
39   ShellDevToolsFrontend(Shell* frontend_shell, DevToolsAgentHost* agent_host);
40   virtual ~ShellDevToolsFrontend();
41
42   // WebContentsObserver overrides
43   virtual void RenderViewCreated(RenderViewHost* render_view_host) OVERRIDE;
44   virtual void DocumentOnLoadCompletedInMainFrame(int32 page_id) OVERRIDE;
45   virtual void WebContentsDestroyed(WebContents* web_contents) OVERRIDE;
46
47   // DevToolsFrontendHostDelegate implementation
48   virtual void DispatchOnEmbedder(const std::string& message) OVERRIDE {}
49
50   virtual void InspectedContentsClosing() OVERRIDE;
51
52   Shell* frontend_shell_;
53   scoped_refptr<DevToolsAgentHost> agent_host_;
54   scoped_ptr<DevToolsClientHost> frontend_host_;
55
56   DISALLOW_COPY_AND_ASSIGN(ShellDevToolsFrontend);
57 };
58
59 }  // namespace content
60
61 #endif  // CONTENT_SHELL_BROWSER_SHELL_DEVTOOLS_FRONTEND_H_