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_frontend_host.h" | 13 #include "content/public/browser/devtools_frontend_host.h" |
14 #include "content/public/browser/web_contents_observer.h" | 14 #include "content/public/browser/web_contents_observer.h" |
15 | 15 |
16 namespace content { | 16 namespace content { |
17 | 17 |
18 GURL GetDevToolsPathAsURL(const std::string& settings, | |
19 const std::string& frontend_url); | |
20 | |
21 class RenderViewHost; | 18 class RenderViewHost; |
22 class Shell; | 19 class Shell; |
23 class WebContents; | 20 class WebContents; |
24 | 21 |
25 class ShellDevToolsFrontend : public WebContentsObserver, | 22 class ShellDevToolsFrontend : public WebContentsObserver, |
26 public DevToolsFrontendHost::Delegate, | 23 public DevToolsFrontendHost::Delegate, |
27 public DevToolsAgentHostClient { | 24 public DevToolsAgentHostClient { |
28 public: | 25 public: |
29 static ShellDevToolsFrontend* Show(WebContents* inspected_contents); | 26 static ShellDevToolsFrontend* Show(WebContents* inspected_contents); |
30 static ShellDevToolsFrontend* Show(WebContents* inspected_contents, | 27 |
31 const std::string& settings, | |
32 const std::string& frontend_url); | |
33 void Activate(); | 28 void Activate(); |
34 void Focus(); | 29 void Focus(); |
35 void InspectElementAt(int x, int y); | 30 void InspectElementAt(int x, int y); |
36 void Close(); | 31 void Close(); |
37 | 32 |
38 Shell* frontend_shell() const { return frontend_shell_; } | 33 Shell* frontend_shell() const { return frontend_shell_; } |
39 | 34 |
40 private: | 35 protected: |
41 ShellDevToolsFrontend(Shell* frontend_shell, DevToolsAgentHost* agent_host); | 36 ShellDevToolsFrontend(Shell* frontend_shell, DevToolsAgentHost* agent_host); |
42 virtual ~ShellDevToolsFrontend(); | 37 virtual ~ShellDevToolsFrontend(); |
43 | 38 |
| 39 private: |
44 // WebContentsObserver overrides | 40 // WebContentsObserver overrides |
45 virtual void RenderViewCreated(RenderViewHost* render_view_host) override; | 41 virtual void RenderViewCreated(RenderViewHost* render_view_host) override; |
46 virtual void DocumentOnLoadCompletedInMainFrame() override; | 42 virtual void DocumentOnLoadCompletedInMainFrame() override; |
47 virtual void WebContentsDestroyed() override; | 43 virtual void WebContentsDestroyed() override; |
48 virtual void RenderProcessGone(base::TerminationStatus status) override; | 44 virtual void RenderProcessGone(base::TerminationStatus status) override; |
49 | 45 |
50 // content::DevToolsFrontendHost::Delegate implementation. | 46 // content::DevToolsFrontendHost::Delegate implementation. |
51 virtual void HandleMessageFromDevToolsFrontend( | 47 virtual void HandleMessageFromDevToolsFrontend( |
52 const std::string& message) override; | 48 const std::string& message) override; |
53 virtual void HandleMessageFromDevToolsFrontendToBackend( | 49 virtual void HandleMessageFromDevToolsFrontendToBackend( |
54 const std::string& message) override; | 50 const std::string& message) override; |
55 | 51 |
56 // content::DevToolsAgentHostClient implementation. | 52 // content::DevToolsAgentHostClient implementation. |
57 virtual void DispatchProtocolMessage( | 53 virtual void DispatchProtocolMessage( |
58 DevToolsAgentHost* agent_host, const std::string& message) override; | 54 DevToolsAgentHost* agent_host, const std::string& message) override; |
59 virtual void AgentHostClosed( | 55 virtual void AgentHostClosed( |
60 DevToolsAgentHost* agent_host, bool replaced) override; | 56 DevToolsAgentHost* agent_host, bool replaced) override; |
61 | 57 |
62 Shell* frontend_shell_; | 58 Shell* frontend_shell_; |
63 scoped_refptr<DevToolsAgentHost> agent_host_; | 59 scoped_refptr<DevToolsAgentHost> agent_host_; |
64 scoped_ptr<DevToolsFrontendHost> frontend_host_; | 60 scoped_ptr<DevToolsFrontendHost> frontend_host_; |
65 | 61 |
66 DISALLOW_COPY_AND_ASSIGN(ShellDevToolsFrontend); | 62 DISALLOW_COPY_AND_ASSIGN(ShellDevToolsFrontend); |
67 }; | 63 }; |
68 | 64 |
69 } // namespace content | 65 } // namespace content |
70 | 66 |
71 #endif // CONTENT_SHELL_BROWSER_SHELL_DEVTOOLS_FRONTEND_H_ | 67 #endif // CONTENT_SHELL_BROWSER_SHELL_DEVTOOLS_FRONTEND_H_ |
OLD | NEW |