blob: adfe90e7d46b90377fba1ad3db5b9df3ecf38681 [file] [log] [blame]
[email protected]de7d61ff2013-08-20 11:30:411// Copyright 2013 The Chromium Authors. All rights reserved.
[email protected]0773e0c2013-01-25 15:57:572// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
[email protected]de7d61ff2013-08-20 11:30:415#ifndef CONTENT_SHELL_BROWSER_SHELL_DEVTOOLS_FRONTEND_H_
6#define CONTENT_SHELL_BROWSER_SHELL_DEVTOOLS_FRONTEND_H_
[email protected]0773e0c2013-01-25 15:57:577
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]657e9e5d2014-08-01 17:14:3913#include "content/public/browser/devtools_frontend_host.h"
[email protected]0773e0c2013-01-25 15:57:5714#include "content/public/browser/web_contents_observer.h"
15
16namespace content {
17
18class RenderViewHost;
19class Shell;
20class WebContents;
21
22class ShellDevToolsFrontend : public WebContentsObserver,
[email protected]657e9e5d2014-08-01 17:14:3923 public DevToolsFrontendHost::Delegate,
[email protected]b50452f2014-08-18 12:31:4424 public DevToolsAgentHostClient {
[email protected]0773e0c2013-01-25 15:57:5725 public:
26 static ShellDevToolsFrontend* Show(WebContents* inspected_contents);
mkwst30d20d52014-10-09 13:33:1427
[email protected]546618b2013-10-20 21:17:3228 void Activate();
[email protected]0773e0c2013-01-25 15:57:5729 void Focus();
[email protected]2317fcd2014-02-10 14:36:4830 void InspectElementAt(int x, int y);
[email protected]0773e0c2013-01-25 15:57:5731 void Close();
32
pfeldman552756452015-02-03 17:33:0633 void DisconnectFromTarget();
34
[email protected]d212efd2013-04-15 13:03:0635 Shell* frontend_shell() const { return frontend_shell_; }
36
mkwst30d20d52014-10-09 13:33:1437 protected:
[email protected]0773e0c2013-01-25 15:57:5738 ShellDevToolsFrontend(Shell* frontend_shell, DevToolsAgentHost* agent_host);
dchenge933b3e2014-10-21 11:44:0939 ~ShellDevToolsFrontend() override;
[email protected]0773e0c2013-01-25 15:57:5740
pfeldman552756452015-02-03 17:33:0641 // 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
mkwst30d20d52014-10-09 13:33:1447 private:
[email protected]0773e0c2013-01-25 15:57:5748 // WebContentsObserver overrides
dchenge933b3e2014-10-21 11:44:0949 void RenderViewCreated(RenderViewHost* render_view_host) override;
pfeldman552756452015-02-03 17:33:0650 void DidNavigateMainFrame(
51 const LoadCommittedDetails& details,
52 const FrameNavigateParams& params) override;
dchenge933b3e2014-10-21 11:44:0953 void WebContentsDestroyed() override;
[email protected]0773e0c2013-01-25 15:57:5754
[email protected]657e9e5d2014-08-01 17:14:3955 // content::DevToolsFrontendHost::Delegate implementation.
dchenge933b3e2014-10-21 11:44:0956 void HandleMessageFromDevToolsFrontend(const std::string& message) override;
57 void HandleMessageFromDevToolsFrontendToBackend(
anand.ratn449f39a42014-10-06 13:45:5758 const std::string& message) override;
[email protected]200bd332013-08-05 16:19:1159
[email protected]0773e0c2013-01-25 15:57:5760 Shell* frontend_shell_;
61 scoped_refptr<DevToolsAgentHost> agent_host_;
[email protected]657e9e5d2014-08-01 17:14:3962 scoped_ptr<DevToolsFrontendHost> frontend_host_;
[email protected]0773e0c2013-01-25 15:57:5763
64 DISALLOW_COPY_AND_ASSIGN(ShellDevToolsFrontend);
65};
66
67} // namespace content
68
[email protected]de7d61ff2013-08-20 11:30:4169#endif // CONTENT_SHELL_BROWSER_SHELL_DEVTOOLS_FRONTEND_H_