| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 CHROME_BROWSER_DEBUGGER_DEVTOOLS_WINDOW_H_ | 5 #ifndef CHROME_BROWSER_DEBUGGER_DEVTOOLS_WINDOW_H_ |
| 6 #define CHROME_BROWSER_DEBUGGER_DEVTOOLS_WINDOW_H_ | 6 #define CHROME_BROWSER_DEBUGGER_DEVTOOLS_WINDOW_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
| 13 #include "chrome/browser/debugger/devtools_toggle_action.h" | 13 #include "chrome/browser/debugger/devtools_toggle_action.h" |
| 14 #include "content/browser/debugger/devtools_client_host.h" | |
| 15 #include "content/browser/tab_contents/tab_contents_delegate.h" | 14 #include "content/browser/tab_contents/tab_contents_delegate.h" |
| 16 #include "content/public/browser/devtools_frontend_window_delegate.h" | 15 #include "content/public/browser/devtools_client_host.h" |
| 16 #include "content/public/browser/devtools_frontend_host_delegate.h" |
| 17 #include "content/public/browser/notification_observer.h" | 17 #include "content/public/browser/notification_observer.h" |
| 18 #include "content/public/browser/notification_registrar.h" | 18 #include "content/public/browser/notification_registrar.h" |
| 19 | 19 |
| 20 namespace IPC { | 20 namespace IPC { |
| 21 class Message; | 21 class Message; |
| 22 } | 22 } |
| 23 | 23 |
| 24 class Browser; | 24 class Browser; |
| 25 class BrowserWindow; | 25 class BrowserWindow; |
| 26 class DevToolsAgentHost; | |
| 27 class PrefService; | 26 class PrefService; |
| 28 class Profile; | 27 class Profile; |
| 29 class RenderViewHost; | 28 class RenderViewHost; |
| 30 class TabContentsWrapper; | 29 class TabContentsWrapper; |
| 31 | 30 |
| 32 namespace base { | 31 namespace base { |
| 33 class Value; | 32 class Value; |
| 34 } | 33 } |
| 35 | 34 |
| 36 class DevToolsWindow : public DevToolsClientHost, | 35 namespace content { |
| 37 private content::NotificationObserver, | 36 class DevToolsAgentHost; |
| 37 class DevToolsClientHost; |
| 38 } |
| 39 |
| 40 class DevToolsWindow : private content::NotificationObserver, |
| 38 private TabContentsDelegate, | 41 private TabContentsDelegate, |
| 39 private content::DevToolsFrontendWindowDelegate { | 42 private content::DevToolsFrontendHostDelegate { |
| 40 public: | 43 public: |
| 41 static const char kDevToolsApp[]; | 44 static const char kDevToolsApp[]; |
| 42 static void RegisterUserPrefs(PrefService* prefs); | 45 static void RegisterUserPrefs(PrefService* prefs); |
| 43 static TabContentsWrapper* GetDevToolsContents(TabContents* inspected_tab); | 46 static TabContentsWrapper* GetDevToolsContents(TabContents* inspected_tab); |
| 44 static bool IsDevToolsWindow(RenderViewHost* window_rvh); | 47 static bool IsDevToolsWindow(RenderViewHost* window_rvh); |
| 45 | 48 |
| 46 static DevToolsWindow* OpenDevToolsWindowForWorker( | 49 static DevToolsWindow* OpenDevToolsWindowForWorker( |
| 47 Profile* profile, | 50 Profile* profile, |
| 48 DevToolsAgentHost* worker_agent); | 51 content::DevToolsAgentHost* worker_agent); |
| 49 static DevToolsWindow* CreateDevToolsWindowForWorker(Profile* profile); | 52 static DevToolsWindow* CreateDevToolsWindowForWorker(Profile* profile); |
| 50 static DevToolsWindow* OpenDevToolsWindow(RenderViewHost* inspected_rvh); | 53 static DevToolsWindow* OpenDevToolsWindow(RenderViewHost* inspected_rvh); |
| 51 static DevToolsWindow* ToggleDevToolsWindow(RenderViewHost* inspected_rvh, | 54 static DevToolsWindow* ToggleDevToolsWindow(RenderViewHost* inspected_rvh, |
| 52 DevToolsToggleAction action); | 55 DevToolsToggleAction action); |
| 53 static void InspectElement(RenderViewHost* inspected_rvh, int x, int y); | 56 static void InspectElement(RenderViewHost* inspected_rvh, int x, int y); |
| 54 | 57 |
| 55 virtual ~DevToolsWindow(); | 58 virtual ~DevToolsWindow(); |
| 56 | 59 |
| 57 // Overridden from DevToolsClientHost. | 60 // Overridden from DevToolsClientHost. |
| 58 virtual void SendMessageToClient(const IPC::Message& message) OVERRIDE; | |
| 59 virtual void InspectedTabClosing() OVERRIDE; | 61 virtual void InspectedTabClosing() OVERRIDE; |
| 60 virtual void TabReplaced(TabContents* new_tab) OVERRIDE; | 62 virtual void TabReplaced(TabContents* new_tab) OVERRIDE; |
| 61 RenderViewHost* GetRenderViewHost(); | 63 RenderViewHost* GetRenderViewHost(); |
| 62 | 64 |
| 63 void Show(DevToolsToggleAction action); | 65 void Show(DevToolsToggleAction action); |
| 64 | 66 |
| 65 TabContentsWrapper* tab_contents() { return tab_contents_; } | 67 TabContentsWrapper* tab_contents() { return tab_contents_; } |
| 66 Browser* browser() { return browser_; } // For tests. | 68 Browser* browser() { return browser_; } // For tests. |
| 67 bool is_docked() { return docked_; } | 69 bool is_docked() { return docked_; } |
| 70 content::DevToolsClientHost* devtools_client_host() { |
| 71 return frontend_host_; |
| 72 } |
| 68 | 73 |
| 69 private: | 74 private: |
| 70 static DevToolsWindow* Create(Profile* profile, | 75 static DevToolsWindow* Create(Profile* profile, |
| 71 RenderViewHost* inspected_rvh, | 76 RenderViewHost* inspected_rvh, |
| 72 bool docked, bool shared_worker_frontend); | 77 bool docked, bool shared_worker_frontend); |
| 73 DevToolsWindow(TabContentsWrapper* tab_contents, Profile* profile, | 78 DevToolsWindow(TabContentsWrapper* tab_contents, Profile* profile, |
| 74 RenderViewHost* inspected_rvh, bool docked); | 79 RenderViewHost* inspected_rvh, bool docked); |
| 75 | 80 |
| 76 void CreateDevToolsBrowser(); | 81 void CreateDevToolsBrowser(); |
| 77 bool FindInspectedBrowserAndTabIndex(Browser**, int* tab); | 82 bool FindInspectedBrowserAndTabIndex(Browser**, int* tab); |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 114 virtual void HandleKeyboardEvent( | 119 virtual void HandleKeyboardEvent( |
| 115 const NativeWebKeyboardEvent& event) OVERRIDE; | 120 const NativeWebKeyboardEvent& event) OVERRIDE; |
| 116 virtual content::JavaScriptDialogCreator* | 121 virtual content::JavaScriptDialogCreator* |
| 117 GetJavaScriptDialogCreator() OVERRIDE; | 122 GetJavaScriptDialogCreator() OVERRIDE; |
| 118 | 123 |
| 119 virtual void FrameNavigating(const std::string& url) OVERRIDE {} | 124 virtual void FrameNavigating(const std::string& url) OVERRIDE {} |
| 120 | 125 |
| 121 static DevToolsWindow* ToggleDevToolsWindow(RenderViewHost* inspected_rvh, | 126 static DevToolsWindow* ToggleDevToolsWindow(RenderViewHost* inspected_rvh, |
| 122 bool force_open, | 127 bool force_open, |
| 123 DevToolsToggleAction action); | 128 DevToolsToggleAction action); |
| 124 static DevToolsWindow* AsDevToolsWindow(DevToolsClientHost*); | 129 static DevToolsWindow* AsDevToolsWindow(content::DevToolsClientHost*); |
| 125 | 130 |
| 126 // content::DevToolsClientHandlerDelegate overrides. | 131 // content::DevToolsClientHandlerDelegate overrides. |
| 127 virtual void ForwardToDevToolsAgent(const IPC::Message& message) OVERRIDE; | |
| 128 virtual void ActivateWindow() OVERRIDE; | 132 virtual void ActivateWindow() OVERRIDE; |
| 129 virtual void CloseWindow() OVERRIDE; | 133 virtual void CloseWindow() OVERRIDE; |
| 130 virtual void MoveWindow(int x, int y) OVERRIDE; | 134 virtual void MoveWindow(int x, int y) OVERRIDE; |
| 131 virtual void DockWindow() OVERRIDE; | 135 virtual void DockWindow() OVERRIDE; |
| 132 virtual void UndockWindow() OVERRIDE; | 136 virtual void UndockWindow() OVERRIDE; |
| 133 virtual void SaveToFile(const std::string& suggested_file_name, | 137 virtual void SaveToFile(const std::string& suggested_file_name, |
| 134 const std::string& content) OVERRIDE; | 138 const std::string& content) OVERRIDE; |
| 139 |
| 135 void RequestSetDocked(bool docked); | 140 void RequestSetDocked(bool docked); |
| 136 | 141 |
| 137 Profile* profile_; | 142 Profile* profile_; |
| 138 TabContentsWrapper* inspected_tab_; | 143 TabContentsWrapper* inspected_tab_; |
| 139 TabContentsWrapper* tab_contents_; | 144 TabContentsWrapper* tab_contents_; |
| 140 Browser* browser_; | 145 Browser* browser_; |
| 141 bool docked_; | 146 bool docked_; |
| 142 bool is_loaded_; | 147 bool is_loaded_; |
| 143 DevToolsToggleAction action_on_load_; | 148 DevToolsToggleAction action_on_load_; |
| 144 content::NotificationRegistrar registrar_; | 149 content::NotificationRegistrar registrar_; |
| 150 content::DevToolsClientHost* frontend_host_; |
| 145 DISALLOW_COPY_AND_ASSIGN(DevToolsWindow); | 151 DISALLOW_COPY_AND_ASSIGN(DevToolsWindow); |
| 146 }; | 152 }; |
| 147 | 153 |
| 148 #endif // CHROME_BROWSER_DEBUGGER_DEVTOOLS_WINDOW_H_ | 154 #endif // CHROME_BROWSER_DEBUGGER_DEVTOOLS_WINDOW_H_ |
| OLD | NEW |