| 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 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> |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 | 21 |
| 22 namespace IPC { | 22 namespace IPC { |
| 23 class Message; | 23 class Message; |
| 24 } | 24 } |
| 25 | 25 |
| 26 class Browser; | 26 class Browser; |
| 27 class BrowserWindow; | 27 class BrowserWindow; |
| 28 class PrefService; | 28 class PrefService; |
| 29 class Profile; | 29 class Profile; |
| 30 class TabContents; | 30 class TabContents; |
| 31 typedef TabContents TabContentsWrapper; | |
| 32 | 31 |
| 33 namespace base { | 32 namespace base { |
| 34 class Value; | 33 class Value; |
| 35 } | 34 } |
| 36 | 35 |
| 37 namespace content { | 36 namespace content { |
| 38 class DevToolsAgentHost; | 37 class DevToolsAgentHost; |
| 39 class DevToolsClientHost; | 38 class DevToolsClientHost; |
| 40 class RenderViewHost; | 39 class RenderViewHost; |
| 41 class WebContents; | 40 class WebContents; |
| 42 } | 41 } |
| 43 | 42 |
| 44 class DevToolsWindow : private content::NotificationObserver, | 43 class DevToolsWindow : private content::NotificationObserver, |
| 45 private content::WebContentsDelegate, | 44 private content::WebContentsDelegate, |
| 46 private content::DevToolsFrontendHostDelegate, | 45 private content::DevToolsFrontendHostDelegate, |
| 47 private DevToolsFileHelper::Delegate { | 46 private DevToolsFileHelper::Delegate { |
| 48 public: | 47 public: |
| 49 static const char kDevToolsApp[]; | 48 static const char kDevToolsApp[]; |
| 50 static void RegisterUserPrefs(PrefService* prefs); | 49 static void RegisterUserPrefs(PrefService* prefs); |
| 51 static TabContentsWrapper* GetDevToolsContents( | 50 static TabContents* GetDevToolsContents(content::WebContents* inspected_tab); |
| 52 content::WebContents* inspected_tab); | |
| 53 static bool IsDevToolsWindow(content::RenderViewHost* window_rvh); | 51 static bool IsDevToolsWindow(content::RenderViewHost* window_rvh); |
| 54 | 52 |
| 55 static DevToolsWindow* OpenDevToolsWindowForWorker( | 53 static DevToolsWindow* OpenDevToolsWindowForWorker( |
| 56 Profile* profile, | 54 Profile* profile, |
| 57 content::DevToolsAgentHost* worker_agent); | 55 content::DevToolsAgentHost* worker_agent); |
| 58 static DevToolsWindow* CreateDevToolsWindowForWorker(Profile* profile); | 56 static DevToolsWindow* CreateDevToolsWindowForWorker(Profile* profile); |
| 59 static DevToolsWindow* OpenDevToolsWindow( | 57 static DevToolsWindow* OpenDevToolsWindow( |
| 60 content::RenderViewHost* inspected_rvh); | 58 content::RenderViewHost* inspected_rvh); |
| 61 static DevToolsWindow* ToggleDevToolsWindow( | 59 static DevToolsWindow* ToggleDevToolsWindow( |
| 62 content::RenderViewHost* inspected_rvh, | 60 content::RenderViewHost* inspected_rvh, |
| 63 DevToolsToggleAction action); | 61 DevToolsToggleAction action); |
| 64 static void InspectElement( | 62 static void InspectElement( |
| 65 content::RenderViewHost* inspected_rvh, int x, int y); | 63 content::RenderViewHost* inspected_rvh, int x, int y); |
| 66 | 64 |
| 67 virtual ~DevToolsWindow(); | 65 virtual ~DevToolsWindow(); |
| 68 | 66 |
| 69 // Overridden from DevToolsClientHost. | 67 // Overridden from DevToolsClientHost. |
| 70 virtual void InspectedContentsClosing() OVERRIDE; | 68 virtual void InspectedContentsClosing() OVERRIDE; |
| 71 virtual void ContentsReplaced(content::WebContents* new_contents) OVERRIDE; | 69 virtual void ContentsReplaced(content::WebContents* new_contents) OVERRIDE; |
| 72 content::RenderViewHost* GetRenderViewHost(); | 70 content::RenderViewHost* GetRenderViewHost(); |
| 73 | 71 |
| 74 void Show(DevToolsToggleAction action); | 72 void Show(DevToolsToggleAction action); |
| 75 | 73 |
| 76 TabContentsWrapper* tab_contents() { return tab_contents_; } | 74 TabContents* tab_contents() { return tab_contents_; } |
| 77 Browser* browser() { return browser_; } // For tests. | 75 Browser* browser() { return browser_; } // For tests. |
| 78 bool is_docked() { return docked_; } | 76 bool is_docked() { return docked_; } |
| 79 content::DevToolsClientHost* devtools_client_host() { | 77 content::DevToolsClientHost* devtools_client_host() { |
| 80 return frontend_host_; | 78 return frontend_host_; |
| 81 } | 79 } |
| 82 | 80 |
| 83 private: | 81 private: |
| 84 static DevToolsWindow* Create(Profile* profile, | 82 static DevToolsWindow* Create(Profile* profile, |
| 85 content::RenderViewHost* inspected_rvh, | 83 content::RenderViewHost* inspected_rvh, |
| 86 bool docked, bool shared_worker_frontend); | 84 bool docked, bool shared_worker_frontend); |
| 87 DevToolsWindow(TabContentsWrapper* tab_contents, Profile* profile, | 85 DevToolsWindow(TabContents* tab_contents, Profile* profile, |
| 88 content::RenderViewHost* inspected_rvh, bool docked); | 86 content::RenderViewHost* inspected_rvh, bool docked); |
| 89 | 87 |
| 90 void CreateDevToolsBrowser(); | 88 void CreateDevToolsBrowser(); |
| 91 bool FindInspectedBrowserAndTabIndex(Browser**, int* tab); | 89 bool FindInspectedBrowserAndTabIndex(Browser**, int* tab); |
| 92 BrowserWindow* GetInspectedBrowserWindow(); | 90 BrowserWindow* GetInspectedBrowserWindow(); |
| 93 bool IsInspectedBrowserPopupOrPanel(); | 91 bool IsInspectedBrowserPopupOrPanel(); |
| 94 void UpdateFrontendAttachedState(); | 92 void UpdateFrontendAttachedState(); |
| 95 | 93 |
| 96 // Overridden from content::NotificationObserver. | 94 // Overridden from content::NotificationObserver. |
| 97 virtual void Observe(int type, | 95 virtual void Observe(int type, |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 147 virtual void AppendToFile(const std::string& url, | 145 virtual void AppendToFile(const std::string& url, |
| 148 const std::string& content) OVERRIDE; | 146 const std::string& content) OVERRIDE; |
| 149 | 147 |
| 150 // Overridden from DevToolsFileHelper::Delegate | 148 // Overridden from DevToolsFileHelper::Delegate |
| 151 virtual void FileSavedAs(const std::string& url) OVERRIDE; | 149 virtual void FileSavedAs(const std::string& url) OVERRIDE; |
| 152 virtual void AppendedTo(const std::string& url) OVERRIDE; | 150 virtual void AppendedTo(const std::string& url) OVERRIDE; |
| 153 | 151 |
| 154 void RequestSetDocked(bool docked); | 152 void RequestSetDocked(bool docked); |
| 155 | 153 |
| 156 Profile* profile_; | 154 Profile* profile_; |
| 157 TabContentsWrapper* inspected_tab_; | 155 TabContents* inspected_tab_; |
| 158 TabContentsWrapper* tab_contents_; | 156 TabContents* tab_contents_; |
| 159 Browser* browser_; | 157 Browser* browser_; |
| 160 bool docked_; | 158 bool docked_; |
| 161 bool is_loaded_; | 159 bool is_loaded_; |
| 162 DevToolsToggleAction action_on_load_; | 160 DevToolsToggleAction action_on_load_; |
| 163 content::NotificationRegistrar registrar_; | 161 content::NotificationRegistrar registrar_; |
| 164 content::DevToolsClientHost* frontend_host_; | 162 content::DevToolsClientHost* frontend_host_; |
| 165 scoped_ptr<DevToolsFileHelper> file_helper_; | 163 scoped_ptr<DevToolsFileHelper> file_helper_; |
| 166 DISALLOW_COPY_AND_ASSIGN(DevToolsWindow); | 164 DISALLOW_COPY_AND_ASSIGN(DevToolsWindow); |
| 167 }; | 165 }; |
| 168 | 166 |
| 169 #endif // CHROME_BROWSER_DEBUGGER_DEVTOOLS_WINDOW_H_ | 167 #endif // CHROME_BROWSER_DEBUGGER_DEVTOOLS_WINDOW_H_ |
| OLD | NEW |