[email protected] | de7d61ff | 2013-08-20 11:30:41 | [diff] [blame] | 1 | // Copyright 2013 The Chromium Authors. All rights reserved. |
[email protected] | 0773e0c | 2013-01-25 15:57:57 | [diff] [blame] | 2 | // Use of this source code is governed by a BSD-style license that can be |
3 | // found in the LICENSE file. | ||||
4 | |||||
[email protected] | de7d61ff | 2013-08-20 11:30:41 | [diff] [blame] | 5 | #ifndef CONTENT_SHELL_BROWSER_SHELL_DEVTOOLS_FRONTEND_H_ |
6 | #define CONTENT_SHELL_BROWSER_SHELL_DEVTOOLS_FRONTEND_H_ | ||||
[email protected] | 0773e0c | 2013-01-25 15:57:57 | [diff] [blame] | 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" | ||||
[email protected] | 657e9e5d | 2014-08-01 17:14:39 | [diff] [blame] | 13 | #include "content/public/browser/devtools_frontend_host.h" |
[email protected] | 0773e0c | 2013-01-25 15:57:57 | [diff] [blame] | 14 | #include "content/public/browser/web_contents_observer.h" |
15 | |||||
16 | namespace content { | ||||
17 | |||||
18 | class RenderViewHost; | ||||
19 | class Shell; | ||||
20 | class WebContents; | ||||
21 | |||||
22 | class ShellDevToolsFrontend : public WebContentsObserver, | ||||
[email protected] | 657e9e5d | 2014-08-01 17:14:39 | [diff] [blame] | 23 | public DevToolsFrontendHost::Delegate, |
[email protected] | b50452f | 2014-08-18 12:31:44 | [diff] [blame] | 24 | public DevToolsAgentHostClient { |
[email protected] | 0773e0c | 2013-01-25 15:57:57 | [diff] [blame] | 25 | public: |
26 | static ShellDevToolsFrontend* Show(WebContents* inspected_contents); | ||||
mkwst | 30d20d5 | 2014-10-09 13:33:14 | [diff] [blame] | 27 | |
[email protected] | 546618b | 2013-10-20 21:17:32 | [diff] [blame] | 28 | void Activate(); |
[email protected] | 0773e0c | 2013-01-25 15:57:57 | [diff] [blame] | 29 | void Focus(); |
[email protected] | 2317fcd | 2014-02-10 14:36:48 | [diff] [blame] | 30 | void InspectElementAt(int x, int y); |
[email protected] | 0773e0c | 2013-01-25 15:57:57 | [diff] [blame] | 31 | void Close(); |
32 | |||||
pfeldman | 55275645 | 2015-02-03 17:33:06 | [diff] [blame^] | 33 | void DisconnectFromTarget(); |
34 | |||||
[email protected] | d212efd | 2013-04-15 13:03:06 | [diff] [blame] | 35 | Shell* frontend_shell() const { return frontend_shell_; } |
36 | |||||
mkwst | 30d20d5 | 2014-10-09 13:33:14 | [diff] [blame] | 37 | protected: |
[email protected] | 0773e0c | 2013-01-25 15:57:57 | [diff] [blame] | 38 | ShellDevToolsFrontend(Shell* frontend_shell, DevToolsAgentHost* agent_host); |
dcheng | e933b3e | 2014-10-21 11:44:09 | [diff] [blame] | 39 | ~ShellDevToolsFrontend() override; |
[email protected] | 0773e0c | 2013-01-25 15:57:57 | [diff] [blame] | 40 | |
pfeldman | 55275645 | 2015-02-03 17:33:06 | [diff] [blame^] | 41 | // content::DevToolsAgentHostClient implementation. |
42 | void AgentHostClosed(DevToolsAgentHost* agent_host, bool replaced) override; | ||||
43 | void DispatchProtocolMessage(DevToolsAgentHost* agent_host, | ||||
44 | const std::string& message) override; | ||||
45 | void AttachTo(WebContents* inspected_contents); | ||||
46 | |||||
mkwst | 30d20d5 | 2014-10-09 13:33:14 | [diff] [blame] | 47 | private: |
[email protected] | 0773e0c | 2013-01-25 15:57:57 | [diff] [blame] | 48 | // WebContentsObserver overrides |
dcheng | e933b3e | 2014-10-21 11:44:09 | [diff] [blame] | 49 | void RenderViewCreated(RenderViewHost* render_view_host) override; |
pfeldman | 55275645 | 2015-02-03 17:33:06 | [diff] [blame^] | 50 | void DidNavigateMainFrame( |
51 | const LoadCommittedDetails& details, | ||||
52 | const FrameNavigateParams& params) override; | ||||
dcheng | e933b3e | 2014-10-21 11:44:09 | [diff] [blame] | 53 | void WebContentsDestroyed() override; |
[email protected] | 0773e0c | 2013-01-25 15:57:57 | [diff] [blame] | 54 | |
[email protected] | 657e9e5d | 2014-08-01 17:14:39 | [diff] [blame] | 55 | // content::DevToolsFrontendHost::Delegate implementation. |
dcheng | e933b3e | 2014-10-21 11:44:09 | [diff] [blame] | 56 | void HandleMessageFromDevToolsFrontend(const std::string& message) override; |
57 | void HandleMessageFromDevToolsFrontendToBackend( | ||||
anand.ratn | 449f39a4 | 2014-10-06 13:45:57 | [diff] [blame] | 58 | const std::string& message) override; |
[email protected] | 200bd33 | 2013-08-05 16:19:11 | [diff] [blame] | 59 | |
[email protected] | 0773e0c | 2013-01-25 15:57:57 | [diff] [blame] | 60 | Shell* frontend_shell_; |
61 | scoped_refptr<DevToolsAgentHost> agent_host_; | ||||
[email protected] | 657e9e5d | 2014-08-01 17:14:39 | [diff] [blame] | 62 | scoped_ptr<DevToolsFrontendHost> frontend_host_; |
[email protected] | 0773e0c | 2013-01-25 15:57:57 | [diff] [blame] | 63 | |
64 | DISALLOW_COPY_AND_ASSIGN(ShellDevToolsFrontend); | ||||
65 | }; | ||||
66 | |||||
67 | } // namespace content | ||||
68 | |||||
[email protected] | de7d61ff | 2013-08-20 11:30:41 | [diff] [blame] | 69 | #endif // CONTENT_SHELL_BROWSER_SHELL_DEVTOOLS_FRONTEND_H_ |