| 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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 // This method will return only fully initialized window ready to be | 54 // This method will return only fully initialized window ready to be |
| 55 // presented in UI. | 55 // presented in UI. |
| 56 // If |out_strategy| is not NULL, it will contain resizing strategy. | 56 // If |out_strategy| is not NULL, it will contain resizing strategy. |
| 57 // For immediately-ready-to-use but maybe not yet fully initialized DevTools | 57 // For immediately-ready-to-use but maybe not yet fully initialized DevTools |
| 58 // use |GetInstanceForInspectedRenderViewHost| instead. | 58 // use |GetInstanceForInspectedRenderViewHost| instead. |
| 59 static content::WebContents* GetInTabWebContents( | 59 static content::WebContents* GetInTabWebContents( |
| 60 content::WebContents* inspected_tab, | 60 content::WebContents* inspected_tab, |
| 61 DevToolsContentsResizingStrategy* out_strategy); | 61 DevToolsContentsResizingStrategy* out_strategy); |
| 62 | 62 |
| 63 static bool IsDevToolsWindow(content::WebContents* web_contents); | 63 static bool IsDevToolsWindow(content::WebContents* web_contents); |
| 64 static DevToolsWindow* AsDevToolsWindow(content::WebContents* web_contents); |
| 64 | 65 |
| 65 // Open or reveal DevTools window, and perform the specified action. | 66 // Open or reveal DevTools window, and perform the specified action. |
| 66 static DevToolsWindow* OpenDevToolsWindow( | 67 static DevToolsWindow* OpenDevToolsWindow( |
| 67 content::WebContents* inspected_web_contents, | 68 content::WebContents* inspected_web_contents, |
| 68 const DevToolsToggleAction& action); | 69 const DevToolsToggleAction& action); |
| 69 | 70 |
| 70 // Open or reveal DevTools window, with no special action. | 71 // Open or reveal DevTools window, with no special action. |
| 71 static DevToolsWindow* OpenDevToolsWindow( | 72 static DevToolsWindow* OpenDevToolsWindow( |
| 72 content::WebContents* inspected_web_contents); | 73 content::WebContents* inspected_web_contents); |
| 73 | 74 |
| (...skipping 19 matching lines...) Expand all Loading... |
| 93 int x, | 94 int x, |
| 94 int y); | 95 int y); |
| 95 | 96 |
| 96 // Sets closure to be called after load is done. If already loaded, calls | 97 // Sets closure to be called after load is done. If already loaded, calls |
| 97 // closure immediately. | 98 // closure immediately. |
| 98 void SetLoadCompletedCallback(const base::Closure& closure); | 99 void SetLoadCompletedCallback(const base::Closure& closure); |
| 99 | 100 |
| 100 // Forwards an unhandled keyboard event to the DevTools frontend. | 101 // Forwards an unhandled keyboard event to the DevTools frontend. |
| 101 bool ForwardKeyboardEvent(const content::NativeWebKeyboardEvent& event); | 102 bool ForwardKeyboardEvent(const content::NativeWebKeyboardEvent& event); |
| 102 | 103 |
| 104 // content::WebContentsDelegate overrides. |
| 105 content::WebContents* OpenURLFromTab( |
| 106 content::WebContents* source, |
| 107 const content::OpenURLParams& params) override; |
| 108 |
| 103 // BeforeUnload interception //////////////////////////////////////////////// | 109 // BeforeUnload interception //////////////////////////////////////////////// |
| 104 | 110 |
| 105 // In order to preserve any edits the user may have made in devtools, the | 111 // In order to preserve any edits the user may have made in devtools, the |
| 106 // beforeunload event of the inspected page is hooked - devtools gets the | 112 // beforeunload event of the inspected page is hooked - devtools gets the |
| 107 // first shot at handling beforeunload and presents a dialog to the user. If | 113 // first shot at handling beforeunload and presents a dialog to the user. If |
| 108 // the user accepts the dialog then the script is given a chance to handle | 114 // the user accepts the dialog then the script is given a chance to handle |
| 109 // it. This way 2 dialogs may be displayed: one from the devtools asking the | 115 // it. This way 2 dialogs may be displayed: one from the devtools asking the |
| 110 // user to confirm that they're ok with their devtools edits going away and | 116 // user to confirm that they're ok with their devtools edits going away and |
| 111 // another from the webpage as the result of its beforeunload handler. | 117 // another from the webpage as the result of its beforeunload handler. |
| 112 // The following set of methods handle beforeunload event flow through | 118 // The following set of methods handle beforeunload event flow through |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 const std::string& remote_frontend, | 217 const std::string& remote_frontend, |
| 212 bool can_dock, | 218 bool can_dock, |
| 213 const std::string& settings); | 219 const std::string& settings); |
| 214 static GURL GetDevToolsURL(Profile* profile, | 220 static GURL GetDevToolsURL(Profile* profile, |
| 215 const GURL& base_url, | 221 const GURL& base_url, |
| 216 bool shared_worker_frontend, | 222 bool shared_worker_frontend, |
| 217 const std::string& remote_frontend, | 223 const std::string& remote_frontend, |
| 218 bool can_dock, | 224 bool can_dock, |
| 219 const std::string& settings); | 225 const std::string& settings); |
| 220 static DevToolsWindow* FindDevToolsWindow(content::DevToolsAgentHost*); | 226 static DevToolsWindow* FindDevToolsWindow(content::DevToolsAgentHost*); |
| 221 static DevToolsWindow* AsDevToolsWindow(content::WebContents*); | |
| 222 static DevToolsWindow* CreateDevToolsWindowForWorker(Profile* profile); | 227 static DevToolsWindow* CreateDevToolsWindowForWorker(Profile* profile); |
| 223 static DevToolsWindow* ToggleDevToolsWindow( | 228 static DevToolsWindow* ToggleDevToolsWindow( |
| 224 content::WebContents* web_contents, | 229 content::WebContents* web_contents, |
| 225 bool force_open, | 230 bool force_open, |
| 226 const DevToolsToggleAction& action, | 231 const DevToolsToggleAction& action, |
| 227 const std::string& settings); | 232 const std::string& settings); |
| 228 | 233 |
| 229 // content::WebContentsDelegate: | 234 // content::WebContentsDelegate: |
| 230 content::WebContents* OpenURLFromTab( | |
| 231 content::WebContents* source, | |
| 232 const content::OpenURLParams& params) override; | |
| 233 void ActivateContents(content::WebContents* contents) override; | 235 void ActivateContents(content::WebContents* contents) override; |
| 234 void AddNewContents(content::WebContents* source, | 236 void AddNewContents(content::WebContents* source, |
| 235 content::WebContents* new_contents, | 237 content::WebContents* new_contents, |
| 236 WindowOpenDisposition disposition, | 238 WindowOpenDisposition disposition, |
| 237 const gfx::Rect& initial_rect, | 239 const gfx::Rect& initial_rect, |
| 238 bool user_gesture, | 240 bool user_gesture, |
| 239 bool* was_blocked) override; | 241 bool* was_blocked) override; |
| 240 void WebContentsCreated(content::WebContents* source_contents, | 242 void WebContentsCreated(content::WebContents* source_contents, |
| 241 int opener_render_frame_id, | 243 int opener_render_frame_id, |
| 242 const base::string16& frame_name, | 244 const base::string16& frame_name, |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 307 base::Closure close_callback_; | 309 base::Closure close_callback_; |
| 308 | 310 |
| 309 base::TimeTicks inspect_element_start_time_; | 311 base::TimeTicks inspect_element_start_time_; |
| 310 scoped_ptr<DevToolsEventForwarder> event_forwarder_; | 312 scoped_ptr<DevToolsEventForwarder> event_forwarder_; |
| 311 | 313 |
| 312 friend class DevToolsEventForwarder; | 314 friend class DevToolsEventForwarder; |
| 313 DISALLOW_COPY_AND_ASSIGN(DevToolsWindow); | 315 DISALLOW_COPY_AND_ASSIGN(DevToolsWindow); |
| 314 }; | 316 }; |
| 315 | 317 |
| 316 #endif // CHROME_BROWSER_DEVTOOLS_DEVTOOLS_WINDOW_H_ | 318 #endif // CHROME_BROWSER_DEVTOOLS_DEVTOOLS_WINDOW_H_ |
| OLD | NEW |