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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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 static DevToolsWindow* AsDevToolsWindow(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 // How to get pointer to the created window see comments for |
68 content::WebContents* inspected_web_contents, | 68 // ToggleDevToolsWindow(). |
69 const DevToolsToggleAction& action); | 69 static void OpenDevToolsWindow(content::WebContents* inspected_web_contents, |
70 const DevToolsToggleAction& action); | |
70 | 71 |
71 // Open or reveal DevTools window, with no special action. | 72 // Open or reveal DevTools window, with no special action. |
72 static DevToolsWindow* OpenDevToolsWindow( | 73 // How to get pointer to the created window see comments for |
73 content::WebContents* inspected_web_contents); | 74 // ToggleDevToolsWindow(). |
75 static void OpenDevToolsWindow(content::WebContents* inspected_web_contents); | |
74 | 76 |
75 // Perform specified action for current WebContents inside a |browser|. | 77 // Perform specified action for current WebContents inside a |browser|. |
76 // This may close currently open DevTools window. | 78 // This may close currently open DevTools window. |
77 static DevToolsWindow* ToggleDevToolsWindow( | 79 // If DeveloperToolsDisabled policy is set, no DevTools window created. |
80 // In case if needed pointer to the created window one should use | |
81 // DevToolsAgentHost and DevToolsWindow::FindDevToolsWindow(). E.g. | |
82 // scoped_refptr<content::DevToolsAgentHost> agent( | |
dgozman
2015/03/10 05:43:24
Please surround code snippet with blank lines and
| |
83 // content::DevToolsAgentHost::GetOrCreateFor(inspected_web_contents)); | |
84 // DevToolsWindow::ToggleDevToolsWindow( | |
85 // inspected_web_contents, DevToolsToggleAction::Show()); | |
86 // DevToolsWindow* window = DevToolsWindow::FindDevToolsWindow(agent.get()); | |
87 static void ToggleDevToolsWindow( | |
78 Browser* browser, | 88 Browser* browser, |
79 const DevToolsToggleAction& action); | 89 const DevToolsToggleAction& action); |
80 | 90 |
81 // External frontend is always undocked. | 91 // External frontend is always undocked. |
82 static void OpenExternalFrontend( | 92 static void OpenExternalFrontend( |
83 Profile* profile, | 93 Profile* profile, |
84 const std::string& frontend_uri, | 94 const std::string& frontend_uri, |
85 const scoped_refptr<content::DevToolsAgentHost>& agent_host, | 95 const scoped_refptr<content::DevToolsAgentHost>& agent_host, |
86 bool isWorker); | 96 bool isWorker); |
87 | 97 |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
173 static bool HasFiredBeforeUnloadEventForDevToolsBrowser(Browser* browser); | 183 static bool HasFiredBeforeUnloadEventForDevToolsBrowser(Browser* browser); |
174 | 184 |
175 // Returns true if devtools window would like to hook beforeunload event | 185 // Returns true if devtools window would like to hook beforeunload event |
176 // of this |contents|. | 186 // of this |contents|. |
177 static bool NeedsToInterceptBeforeUnload(content::WebContents* contents); | 187 static bool NeedsToInterceptBeforeUnload(content::WebContents* contents); |
178 | 188 |
179 // Notify devtools window that closing of |contents| was cancelled | 189 // Notify devtools window that closing of |contents| was cancelled |
180 // by user. | 190 // by user. |
181 static void OnPageCloseCanceled(content::WebContents* contents); | 191 static void OnPageCloseCanceled(content::WebContents* contents); |
182 | 192 |
193 static DevToolsWindow* FindDevToolsWindow(content::DevToolsAgentHost*); | |
dgozman
2015/03/10 05:43:24
Please move this method near |AsDevToolsWindow| in
| |
194 | |
183 private: | 195 private: |
184 friend class DevToolsWindowTesting; | 196 friend class DevToolsWindowTesting; |
185 | 197 |
186 // DevTools lifecycle typically follows this way: | 198 // DevTools lifecycle typically follows this way: |
187 // - Toggle/Open: client call; | 199 // - Toggle/Open: client call; |
188 // - Create; | 200 // - Create; |
189 // - ScheduleShow: setup window to be functional, but not yet show; | 201 // - ScheduleShow: setup window to be functional, but not yet show; |
190 // - DocumentOnLoadCompletedInMainFrame: frontend loaded; | 202 // - DocumentOnLoadCompletedInMainFrame: frontend loaded; |
191 // - SetIsDocked: frontend decided on docking state; | 203 // - SetIsDocked: frontend decided on docking state; |
192 // - OnLoadCompleted: ready to present frontend; | 204 // - OnLoadCompleted: ready to present frontend; |
(...skipping 23 matching lines...) Expand all Loading... | |
216 bool shared_worker_frontend, | 228 bool shared_worker_frontend, |
217 const std::string& remote_frontend, | 229 const std::string& remote_frontend, |
218 bool can_dock, | 230 bool can_dock, |
219 const std::string& settings); | 231 const std::string& settings); |
220 static GURL GetDevToolsURL(Profile* profile, | 232 static GURL GetDevToolsURL(Profile* profile, |
221 const GURL& base_url, | 233 const GURL& base_url, |
222 bool shared_worker_frontend, | 234 bool shared_worker_frontend, |
223 const std::string& remote_frontend, | 235 const std::string& remote_frontend, |
224 bool can_dock, | 236 bool can_dock, |
225 const std::string& settings); | 237 const std::string& settings); |
226 static DevToolsWindow* FindDevToolsWindow(content::DevToolsAgentHost*); | 238 |
227 static DevToolsWindow* CreateDevToolsWindowForWorker(Profile* profile); | 239 static DevToolsWindow* CreateDevToolsWindowForWorker(Profile* profile); |
228 static DevToolsWindow* ToggleDevToolsWindow( | 240 static void ToggleDevToolsWindow( |
229 content::WebContents* web_contents, | 241 content::WebContents* web_contents, |
230 bool force_open, | 242 bool force_open, |
231 const DevToolsToggleAction& action, | 243 const DevToolsToggleAction& action, |
232 const std::string& settings); | 244 const std::string& settings); |
233 | 245 |
234 // content::WebContentsDelegate: | 246 // content::WebContentsDelegate: |
235 void ActivateContents(content::WebContents* contents) override; | 247 void ActivateContents(content::WebContents* contents) override; |
236 void AddNewContents(content::WebContents* source, | 248 void AddNewContents(content::WebContents* source, |
237 content::WebContents* new_contents, | 249 content::WebContents* new_contents, |
238 WindowOpenDisposition disposition, | 250 WindowOpenDisposition disposition, |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
309 base::Closure close_callback_; | 321 base::Closure close_callback_; |
310 | 322 |
311 base::TimeTicks inspect_element_start_time_; | 323 base::TimeTicks inspect_element_start_time_; |
312 scoped_ptr<DevToolsEventForwarder> event_forwarder_; | 324 scoped_ptr<DevToolsEventForwarder> event_forwarder_; |
313 | 325 |
314 friend class DevToolsEventForwarder; | 326 friend class DevToolsEventForwarder; |
315 DISALLOW_COPY_AND_ASSIGN(DevToolsWindow); | 327 DISALLOW_COPY_AND_ASSIGN(DevToolsWindow); |
316 }; | 328 }; |
317 | 329 |
318 #endif // CHROME_BROWSER_DEVTOOLS_DEVTOOLS_WINDOW_H_ | 330 #endif // CHROME_BROWSER_DEVTOOLS_DEVTOOLS_WINDOW_H_ |
OLD | NEW |