| 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_DEVTOOLS_DEVTOOLS_WINDOW_H_ | 5 #ifndef CHROME_BROWSER_DEVTOOLS_DEVTOOLS_WINDOW_H_ |
| 6 #define CHROME_BROWSER_DEVTOOLS_DEVTOOLS_WINDOW_H_ | 6 #define CHROME_BROWSER_DEVTOOLS_DEVTOOLS_WINDOW_H_ |
| 7 | 7 |
| 8 #include "chrome/browser/devtools/devtools_contents_resizing_strategy.h" | 8 #include "chrome/browser/devtools/devtools_contents_resizing_strategy.h" |
| 9 #include "chrome/browser/devtools/devtools_toggle_action.h" | 9 #include "chrome/browser/devtools/devtools_toggle_action.h" |
| 10 #include "chrome/browser/devtools/devtools_ui_bindings.h" | 10 #include "chrome/browser/devtools/devtools_ui_bindings.h" |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 58 // For immediately-ready-to-use but maybe not yet fully initialized DevTools | 58 // For immediately-ready-to-use but maybe not yet fully initialized DevTools |
| 59 // use |GetInstanceForInspectedRenderViewHost| instead. | 59 // use |GetInstanceForInspectedRenderViewHost| instead. |
| 60 static content::WebContents* GetInTabWebContents( | 60 static content::WebContents* GetInTabWebContents( |
| 61 content::WebContents* inspected_tab, | 61 content::WebContents* inspected_tab, |
| 62 DevToolsContentsResizingStrategy* out_strategy); | 62 DevToolsContentsResizingStrategy* out_strategy); |
| 63 | 63 |
| 64 static bool IsDevToolsWindow(content::WebContents* web_contents); | 64 static bool IsDevToolsWindow(content::WebContents* web_contents); |
| 65 | 65 |
| 66 // Open or reveal DevTools window, and perform the specified action. | 66 // Open or reveal DevTools window, and perform the specified action. |
| 67 static DevToolsWindow* OpenDevToolsWindow( | 67 static DevToolsWindow* OpenDevToolsWindow( |
| 68 content::RenderViewHost* inspected_rvh, | 68 content::WebContents* inspected_web_contents, |
| 69 const DevToolsToggleAction& action); | 69 const DevToolsToggleAction& action); |
| 70 | 70 |
| 71 // Open or reveal DevTools window, with no special action. | 71 // Open or reveal DevTools window, with no special action. |
| 72 static DevToolsWindow* OpenDevToolsWindow( | 72 static DevToolsWindow* OpenDevToolsWindow( |
| 73 content::RenderViewHost* inspected_rvh); | 73 content::WebContents* inspected_web_contents); |
| 74 | 74 |
| 75 // Perform specified action for current WebContents inside a |browser|. | 75 // Perform specified action for current WebContents inside a |browser|. |
| 76 // This may close currently open DevTools window. | 76 // This may close currently open DevTools window. |
| 77 static DevToolsWindow* ToggleDevToolsWindow( | 77 static DevToolsWindow* ToggleDevToolsWindow( |
| 78 Browser* browser, | 78 Browser* browser, |
| 79 const DevToolsToggleAction& action); | 79 const DevToolsToggleAction& action); |
| 80 | 80 |
| 81 // External frontend is always undocked. | 81 // External frontend is always undocked. |
| 82 static void OpenExternalFrontend( | 82 static void OpenExternalFrontend( |
| 83 Profile* profile, | 83 Profile* profile, |
| 84 const std::string& frontend_uri, | 84 const std::string& frontend_uri, |
| 85 content::DevToolsAgentHost* agent_host); | 85 content::DevToolsAgentHost* agent_host); |
| 86 | 86 |
| 87 // Worker frontend is always undocked. | 87 // Worker frontend is always undocked. |
| 88 static DevToolsWindow* OpenDevToolsWindowForWorker( | 88 static DevToolsWindow* OpenDevToolsWindowForWorker( |
| 89 Profile* profile, | 89 Profile* profile, |
| 90 content::DevToolsAgentHost* worker_agent); | 90 content::DevToolsAgentHost* worker_agent); |
| 91 | 91 |
| 92 static void InspectElement( | 92 static void InspectElement(content::WebContents* inspected_web_contents, |
| 93 content::RenderViewHost* inspected_rvh, int x, int y); | 93 int x, |
| 94 int y); |
| 94 | 95 |
| 95 // Sets closure to be called after load is done. If already loaded, calls | 96 // Sets closure to be called after load is done. If already loaded, calls |
| 96 // closure immediately. | 97 // closure immediately. |
| 97 void SetLoadCompletedCallback(const base::Closure& closure); | 98 void SetLoadCompletedCallback(const base::Closure& closure); |
| 98 | 99 |
| 99 // Forwards an unhandled keyboard event to the DevTools frontend. | 100 // Forwards an unhandled keyboard event to the DevTools frontend. |
| 100 bool ForwardKeyboardEvent(const content::NativeWebKeyboardEvent& event); | 101 bool ForwardKeyboardEvent(const content::NativeWebKeyboardEvent& event); |
| 101 | 102 |
| 102 // BeforeUnload interception //////////////////////////////////////////////// | 103 // BeforeUnload interception //////////////////////////////////////////////// |
| 103 | 104 |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 192 enum LifeStage { | 193 enum LifeStage { |
| 193 kNotLoaded, | 194 kNotLoaded, |
| 194 kOnLoadFired, // Implies SetIsDocked was not yet called. | 195 kOnLoadFired, // Implies SetIsDocked was not yet called. |
| 195 kIsDockedSet, // Implies DocumentOnLoadCompleted was not yet called. | 196 kIsDockedSet, // Implies DocumentOnLoadCompleted was not yet called. |
| 196 kLoadCompleted, | 197 kLoadCompleted, |
| 197 kClosing | 198 kClosing |
| 198 }; | 199 }; |
| 199 | 200 |
| 200 DevToolsWindow(Profile* profile, | 201 DevToolsWindow(Profile* profile, |
| 201 const GURL& frontend_url, | 202 const GURL& frontend_url, |
| 202 content::RenderViewHost* inspected_rvh, | 203 content::WebContents* inspected_web_contents, |
| 203 bool can_dock); | 204 bool can_dock); |
| 204 | 205 |
| 205 static DevToolsWindow* Create(Profile* profile, | 206 static DevToolsWindow* Create(Profile* profile, |
| 206 const GURL& frontend_url, | 207 const GURL& frontend_url, |
| 207 content::RenderViewHost* inspected_rvh, | 208 content::WebContents* inspected_web_contents, |
| 208 bool shared_worker_frontend, | 209 bool shared_worker_frontend, |
| 209 bool external_frontend, | 210 bool external_frontend, |
| 210 bool can_dock, | 211 bool can_dock, |
| 211 const std::string& settings); | 212 const std::string& settings); |
| 212 static GURL GetDevToolsURL(Profile* profile, | 213 static GURL GetDevToolsURL(Profile* profile, |
| 213 const GURL& base_url, | 214 const GURL& base_url, |
| 214 bool shared_worker_frontend, | 215 bool shared_worker_frontend, |
| 215 bool external_frontend, | 216 bool external_frontend, |
| 216 bool can_dock, | 217 bool can_dock, |
| 217 const std::string& settings); | 218 const std::string& settings); |
| 218 static DevToolsWindow* FindDevToolsWindow(content::DevToolsAgentHost*); | 219 static DevToolsWindow* FindDevToolsWindow(content::DevToolsAgentHost*); |
| 219 static DevToolsWindow* AsDevToolsWindow(content::WebContents*); | 220 static DevToolsWindow* AsDevToolsWindow(content::WebContents*); |
| 220 static DevToolsWindow* CreateDevToolsWindowForWorker(Profile* profile); | 221 static DevToolsWindow* CreateDevToolsWindowForWorker(Profile* profile); |
| 221 static DevToolsWindow* ToggleDevToolsWindow( | 222 static DevToolsWindow* ToggleDevToolsWindow( |
| 222 content::RenderViewHost* inspected_rvh, | 223 content::WebContents* web_contents, |
| 223 bool force_open, | 224 bool force_open, |
| 224 const DevToolsToggleAction& action, | 225 const DevToolsToggleAction& action, |
| 225 const std::string& settings); | 226 const std::string& settings); |
| 226 | 227 |
| 227 static std::string GetDevToolsWindowPlacementPrefKey(); | 228 static std::string GetDevToolsWindowPlacementPrefKey(); |
| 228 | 229 |
| 229 // content::WebContentsDelegate: | 230 // content::WebContentsDelegate: |
| 230 virtual content::WebContents* OpenURLFromTab( | 231 virtual content::WebContents* OpenURLFromTab( |
| 231 content::WebContents* source, | 232 content::WebContents* source, |
| 232 const content::OpenURLParams& params) OVERRIDE; | 233 const content::OpenURLParams& params) OVERRIDE; |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 313 base::Closure close_callback_; | 314 base::Closure close_callback_; |
| 314 | 315 |
| 315 base::TimeTicks inspect_element_start_time_; | 316 base::TimeTicks inspect_element_start_time_; |
| 316 scoped_ptr<DevToolsEventForwarder> event_forwarder_; | 317 scoped_ptr<DevToolsEventForwarder> event_forwarder_; |
| 317 | 318 |
| 318 friend class DevToolsEventForwarder; | 319 friend class DevToolsEventForwarder; |
| 319 DISALLOW_COPY_AND_ASSIGN(DevToolsWindow); | 320 DISALLOW_COPY_AND_ASSIGN(DevToolsWindow); |
| 320 }; | 321 }; |
| 321 | 322 |
| 322 #endif // CHROME_BROWSER_DEVTOOLS_DEVTOOLS_WINDOW_H_ | 323 #endif // CHROME_BROWSER_DEVTOOLS_DEVTOOLS_WINDOW_H_ |
| OLD | NEW |