OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CONTENT_SHELL_BROWSER_SHELL_DEVTOOLS_FRONTEND_H_ | 5 #ifndef CONTENT_SHELL_BROWSER_SHELL_DEVTOOLS_FRONTEND_H_ |
6 #define CONTENT_SHELL_BROWSER_SHELL_DEVTOOLS_FRONTEND_H_ | 6 #define CONTENT_SHELL_BROWSER_SHELL_DEVTOOLS_FRONTEND_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
12 #include "content/public/browser/devtools_agent_host.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.h" | 13 #include "content/public/browser/devtools_frontend_host.h" |
15 #include "content/public/browser/web_contents_observer.h" | 14 #include "content/public/browser/web_contents_observer.h" |
16 | 15 |
17 namespace content { | 16 namespace content { |
18 | 17 |
19 GURL GetDevToolsPathAsURL(const std::string& settings, | 18 GURL GetDevToolsPathAsURL(const std::string& settings, |
20 const std::string& frontend_url); | 19 const std::string& frontend_url); |
21 | 20 |
22 class RenderViewHost; | 21 class RenderViewHost; |
23 class Shell; | 22 class Shell; |
24 class WebContents; | 23 class WebContents; |
25 | 24 |
26 class ShellDevToolsFrontend : public WebContentsObserver, | 25 class ShellDevToolsFrontend : public WebContentsObserver, |
27 public DevToolsFrontendHost::Delegate, | 26 public DevToolsFrontendHost::Delegate, |
28 public DevToolsClientHost { | 27 public DevToolsAgentHostClient { |
29 public: | 28 public: |
30 static ShellDevToolsFrontend* Show(WebContents* inspected_contents); | 29 static ShellDevToolsFrontend* Show(WebContents* inspected_contents); |
31 static ShellDevToolsFrontend* Show(WebContents* inspected_contents, | 30 static ShellDevToolsFrontend* Show(WebContents* inspected_contents, |
32 const std::string& settings, | 31 const std::string& settings, |
33 const std::string& frontend_url); | 32 const std::string& frontend_url); |
34 void Activate(); | 33 void Activate(); |
35 void Focus(); | 34 void Focus(); |
36 void InspectElementAt(int x, int y); | 35 void InspectElementAt(int x, int y); |
37 void Close(); | 36 void Close(); |
38 | 37 |
39 Shell* frontend_shell() const { return frontend_shell_; } | 38 Shell* frontend_shell() const { return frontend_shell_; } |
40 | 39 |
41 private: | 40 private: |
42 ShellDevToolsFrontend(Shell* frontend_shell, DevToolsAgentHost* agent_host); | 41 ShellDevToolsFrontend(Shell* frontend_shell, DevToolsAgentHost* agent_host); |
43 virtual ~ShellDevToolsFrontend(); | 42 virtual ~ShellDevToolsFrontend(); |
44 | 43 |
45 // WebContentsObserver overrides | 44 // WebContentsObserver overrides |
46 virtual void RenderViewCreated(RenderViewHost* render_view_host) OVERRIDE; | 45 virtual void RenderViewCreated(RenderViewHost* render_view_host) OVERRIDE; |
47 virtual void DocumentOnLoadCompletedInMainFrame() OVERRIDE; | 46 virtual void DocumentOnLoadCompletedInMainFrame() OVERRIDE; |
48 virtual void WebContentsDestroyed() OVERRIDE; | 47 virtual void WebContentsDestroyed() OVERRIDE; |
49 virtual void RenderProcessGone(base::TerminationStatus status) OVERRIDE; | 48 virtual void RenderProcessGone(base::TerminationStatus status) OVERRIDE; |
50 | 49 |
51 // content::DevToolsFrontendHost::Delegate implementation. | 50 // content::DevToolsFrontendHost::Delegate implementation. |
52 virtual void HandleMessageFromDevToolsFrontend( | 51 virtual void HandleMessageFromDevToolsFrontend( |
53 const std::string& message) OVERRIDE; | 52 const std::string& message) OVERRIDE; |
54 virtual void HandleMessageFromDevToolsFrontendToBackend( | 53 virtual void HandleMessageFromDevToolsFrontendToBackend( |
55 const std::string& message) OVERRIDE; | 54 const std::string& message) OVERRIDE; |
56 | 55 |
57 // content::DevToolsClientHost implementation. | 56 // content::DevToolsAgentHostClient implementation. |
58 virtual void DispatchOnInspectorFrontend(const std::string& message) OVERRIDE; | 57 virtual void DispatchProtocolMessage( |
59 virtual void InspectedContentsClosing() OVERRIDE; | 58 DevToolsAgentHost* agent_host, const std::string& message) OVERRIDE; |
60 virtual void ReplacedWithAnotherClient() OVERRIDE {} | 59 virtual void AgentHostClosed( |
| 60 DevToolsAgentHost* agent_host, bool replaced) OVERRIDE; |
61 | 61 |
62 Shell* frontend_shell_; | 62 Shell* frontend_shell_; |
63 scoped_refptr<DevToolsAgentHost> agent_host_; | 63 scoped_refptr<DevToolsAgentHost> agent_host_; |
64 scoped_ptr<DevToolsFrontendHost> frontend_host_; | 64 scoped_ptr<DevToolsFrontendHost> frontend_host_; |
65 | 65 |
66 DISALLOW_COPY_AND_ASSIGN(ShellDevToolsFrontend); | 66 DISALLOW_COPY_AND_ASSIGN(ShellDevToolsFrontend); |
67 }; | 67 }; |
68 | 68 |
69 } // namespace content | 69 } // namespace content |
70 | 70 |
71 #endif // CONTENT_SHELL_BROWSER_SHELL_DEVTOOLS_FRONTEND_H_ | 71 #endif // CONTENT_SHELL_BROWSER_SHELL_DEVTOOLS_FRONTEND_H_ |
OLD | NEW |