| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_BROWSER_DEVTOOLS_RENDER_VIEW_DEVTOOLS_AGENT_HOST_H_ | 5 #ifndef CONTENT_BROWSER_DEVTOOLS_RENDER_VIEW_DEVTOOLS_AGENT_HOST_H_ |
| 6 #define CONTENT_BROWSER_DEVTOOLS_RENDER_VIEW_DEVTOOLS_AGENT_HOST_H_ | 6 #define CONTENT_BROWSER_DEVTOOLS_RENDER_VIEW_DEVTOOLS_AGENT_HOST_H_ |
| 7 | 7 |
| 8 #include <map> | 8 #include <map> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
| 12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
| 13 #include "content/browser/devtools/devtools_agent_host_impl.h" | 13 #include "content/browser/devtools/devtools_agent_host_impl.h" |
| 14 #include "content/common/content_export.h" | 14 #include "content/common/content_export.h" |
| 15 #include "content/public/browser/render_view_host_observer.h" | 15 #include "content/public/browser/render_view_host_observer.h" |
| 16 #include "content/public/browser/web_contents_observer.h" | 16 #include "content/public/browser/web_contents_observer.h" |
| 17 | 17 |
| 18 namespace content { | 18 namespace content { |
| 19 | 19 |
| 20 class DevToolsAgentHostRvhObserver; | 20 class DevToolsAgentHostRvhObserver; |
| 21 class RendererOverridesHandler; |
| 21 class RenderViewHost; | 22 class RenderViewHost; |
| 22 | 23 |
| 23 class CONTENT_EXPORT RenderViewDevToolsAgentHost | 24 class CONTENT_EXPORT RenderViewDevToolsAgentHost |
| 24 : public DevToolsAgentHostImpl, | 25 : public DevToolsAgentHostImpl, |
| 25 private WebContentsObserver { | 26 private WebContentsObserver { |
| 26 public: | 27 public: |
| 27 static void OnCancelPendingNavigation(RenderViewHost* pending, | 28 static void OnCancelPendingNavigation(RenderViewHost* pending, |
| 28 RenderViewHost* current); | 29 RenderViewHost* current); |
| 29 | 30 |
| 30 RenderViewDevToolsAgentHost(RenderViewHost*); | 31 RenderViewDevToolsAgentHost(RenderViewHost*); |
| 31 | 32 |
| 32 RenderViewHost* render_view_host() { return render_view_host_; } | 33 RenderViewHost* render_view_host() { return render_view_host_; } |
| 33 | 34 |
| 34 private: | 35 private: |
| 35 friend class DevToolsAgentHost; | 36 friend class DevToolsAgentHost; |
| 36 friend class DevToolsAgentHostRvhObserver; | 37 friend class DevToolsAgentHostRvhObserver; |
| 37 | 38 |
| 38 virtual ~RenderViewDevToolsAgentHost(); | 39 virtual ~RenderViewDevToolsAgentHost(); |
| 39 | 40 |
| 40 // DevTooolsAgentHost overrides. | 41 // DevTooolsAgentHost overrides. |
| 41 virtual RenderViewHost* GetRenderViewHost() OVERRIDE; | 42 virtual RenderViewHost* GetRenderViewHost() OVERRIDE; |
| 42 | 43 |
| 43 // DevToolsAgentHostImpl overrides. | 44 // DevToolsAgentHostImpl overrides. |
| 44 virtual void DispatchOnInspectorBackend(const std::string& message) OVERRIDE; | 45 virtual void DispatchOnInspectorBackend(const std::string& message) OVERRIDE; |
| 45 | |
| 46 // DevToolsAgentHostImpl implementation. | |
| 47 virtual void SendMessageToAgent(IPC::Message* msg) OVERRIDE; | 46 virtual void SendMessageToAgent(IPC::Message* msg) OVERRIDE; |
| 48 virtual void NotifyClientAttaching() OVERRIDE; | 47 virtual void NotifyClientAttaching() OVERRIDE; |
| 49 virtual void NotifyClientDetaching() OVERRIDE; | 48 virtual void NotifyClientDetaching() OVERRIDE; |
| 50 | 49 |
| 51 // WebContentsObserver overrides. | 50 // WebContentsObserver overrides. |
| 52 virtual void AboutToNavigateRenderView(RenderViewHost* dest_rvh) OVERRIDE; | 51 virtual void AboutToNavigateRenderView(RenderViewHost* dest_rvh) OVERRIDE; |
| 53 | 52 |
| 54 void ConnectRenderViewHost(RenderViewHost* rvh, bool reattach); | 53 void ConnectRenderViewHost(RenderViewHost* rvh, bool reattach); |
| 55 void DisconnectRenderViewHost(); | 54 void DisconnectRenderViewHost(); |
| 56 | 55 |
| 57 void RenderViewHostDestroyed(RenderViewHost* rvh); | 56 void RenderViewHostDestroyed(RenderViewHost* rvh); |
| 58 bool OnRvhMessageReceived(const IPC::Message& message); | 57 bool OnRvhMessageReceived(const IPC::Message& message); |
| 59 | 58 |
| 60 void OnDispatchOnInspectorFrontend(const std::string& message); | 59 void OnDispatchOnInspectorFrontend(const std::string& message); |
| 61 void OnSaveAgentRuntimeState(const std::string& state); | 60 void OnSaveAgentRuntimeState(const std::string& state); |
| 62 void OnClearBrowserCache(); | 61 void OnClearBrowserCache(); |
| 63 void OnClearBrowserCookies(); | 62 void OnClearBrowserCookies(); |
| 64 | 63 |
| 65 bool CaptureScreenshot(std::string* base_64_data); | 64 bool CaptureScreenshot(std::string* base_64_data); |
| 66 | 65 |
| 67 bool HandleJavaScriptDialog(bool accept); | 66 bool HandleJavaScriptDialog(bool accept); |
| 68 | 67 |
| 69 RenderViewHost* render_view_host_; | 68 RenderViewHost* render_view_host_; |
| 70 scoped_ptr<DevToolsAgentHostRvhObserver> rvh_observer_; | 69 scoped_ptr<DevToolsAgentHostRvhObserver> rvh_observer_; |
| 70 scoped_ptr<RendererOverridesHandler> overrides_handler_; |
| 71 std::string state_; | 71 std::string state_; |
| 72 | 72 |
| 73 DISALLOW_COPY_AND_ASSIGN(RenderViewDevToolsAgentHost); | 73 DISALLOW_COPY_AND_ASSIGN(RenderViewDevToolsAgentHost); |
| 74 }; | 74 }; |
| 75 | 75 |
| 76 } // namespace content | 76 } // namespace content |
| 77 | 77 |
| 78 #endif // CONTENT_BROWSER_DEVTOOLS_RENDER_VIEW_DEVTOOLS_AGENT_HOST_H_ | 78 #endif // CONTENT_BROWSER_DEVTOOLS_RENDER_VIEW_DEVTOOLS_AGENT_HOST_H_ |
| OLD | NEW |