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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
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 | 64 |
65 // Open or reveal DevTools window, and perform the specified action. | 65 // Open or reveal DevTools window, and perform the specified action. |
66 static DevToolsWindow* OpenDevToolsWindow( | 66 static void OpenDevToolsWindow(content::WebContents* inspected_web_contents, |
dgozman
2015/03/03 20:04:54
Let's just mention in the comment to each method t
Andrew T Wilson (Slow)
2015/03/04 13:32:42
In my experience, this will lead to crashes becaus
dgozman
2015/03/04 13:44:48
I don't feel strongly. Let's go with void.
| |
67 content::WebContents* inspected_web_contents, | 67 const DevToolsToggleAction& action); |
68 const DevToolsToggleAction& action); | |
69 | 68 |
70 // Open or reveal DevTools window, with no special action. | 69 // Open or reveal DevTools window, with no special action. |
71 static DevToolsWindow* OpenDevToolsWindow( | 70 static void OpenDevToolsWindow(content::WebContents* inspected_web_contents); |
72 content::WebContents* inspected_web_contents); | |
73 | 71 |
74 // Perform specified action for current WebContents inside a |browser|. | 72 // Perform specified action for current WebContents inside a |browser|. |
75 // This may close currently open DevTools window. | 73 // This may close currently open DevTools window. |
76 static DevToolsWindow* ToggleDevToolsWindow( | 74 static DevToolsWindow* ToggleDevToolsWindow( |
dgozman
2015/03/03 20:04:54
This method should be affected by the policy as we
Andrew T Wilson (Slow)
2015/03/04 13:32:42
This uses OpenDevToolsWindow() so it does the righ
dgozman
2015/03/04 13:44:48
The other way around: OpenDevToolsWindow uses Togg
| |
77 Browser* browser, | 75 Browser* browser, |
78 const DevToolsToggleAction& action); | 76 const DevToolsToggleAction& action); |
79 | 77 |
80 // External frontend is always undocked. | 78 // External frontend is always undocked. |
81 static void OpenExternalFrontend( | 79 static void OpenExternalFrontend( |
82 Profile* profile, | 80 Profile* profile, |
83 const std::string& frontend_uri, | 81 const std::string& frontend_uri, |
84 const scoped_refptr<content::DevToolsAgentHost>& agent_host, | 82 const scoped_refptr<content::DevToolsAgentHost>& agent_host, |
85 bool isWorker); | 83 bool isWorker); |
86 | 84 |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
167 static bool HasFiredBeforeUnloadEventForDevToolsBrowser(Browser* browser); | 165 static bool HasFiredBeforeUnloadEventForDevToolsBrowser(Browser* browser); |
168 | 166 |
169 // Returns true if devtools window would like to hook beforeunload event | 167 // Returns true if devtools window would like to hook beforeunload event |
170 // of this |contents|. | 168 // of this |contents|. |
171 static bool NeedsToInterceptBeforeUnload(content::WebContents* contents); | 169 static bool NeedsToInterceptBeforeUnload(content::WebContents* contents); |
172 | 170 |
173 // Notify devtools window that closing of |contents| was cancelled | 171 // Notify devtools window that closing of |contents| was cancelled |
174 // by user. | 172 // by user. |
175 static void OnPageCloseCanceled(content::WebContents* contents); | 173 static void OnPageCloseCanceled(content::WebContents* contents); |
176 | 174 |
175 static DevToolsWindow* FindDevToolsWindow(content::DevToolsAgentHost*); | |
176 | |
177 private: | 177 private: |
178 friend class DevToolsWindowTesting; | 178 friend class DevToolsWindowTesting; |
179 | 179 |
180 // DevTools lifecycle typically follows this way: | 180 // DevTools lifecycle typically follows this way: |
181 // - Toggle/Open: client call; | 181 // - Toggle/Open: client call; |
182 // - Create; | 182 // - Create; |
183 // - ScheduleShow: setup window to be functional, but not yet show; | 183 // - ScheduleShow: setup window to be functional, but not yet show; |
184 // - DocumentOnLoadCompletedInMainFrame: frontend loaded; | 184 // - DocumentOnLoadCompletedInMainFrame: frontend loaded; |
185 // - SetIsDocked: frontend decided on docking state; | 185 // - SetIsDocked: frontend decided on docking state; |
186 // - OnLoadCompleted: ready to present frontend; | 186 // - OnLoadCompleted: ready to present frontend; |
(...skipping 23 matching lines...) Expand all Loading... | |
210 bool shared_worker_frontend, | 210 bool shared_worker_frontend, |
211 const std::string& remote_frontend, | 211 const std::string& remote_frontend, |
212 bool can_dock, | 212 bool can_dock, |
213 const std::string& settings); | 213 const std::string& settings); |
214 static GURL GetDevToolsURL(Profile* profile, | 214 static GURL GetDevToolsURL(Profile* profile, |
215 const GURL& base_url, | 215 const GURL& base_url, |
216 bool shared_worker_frontend, | 216 bool shared_worker_frontend, |
217 const std::string& remote_frontend, | 217 const std::string& remote_frontend, |
218 bool can_dock, | 218 bool can_dock, |
219 const std::string& settings); | 219 const std::string& settings); |
220 static DevToolsWindow* FindDevToolsWindow(content::DevToolsAgentHost*); | 220 |
221 static DevToolsWindow* AsDevToolsWindow(content::WebContents*); | 221 static DevToolsWindow* AsDevToolsWindow(content::WebContents*); |
222 static DevToolsWindow* CreateDevToolsWindowForWorker(Profile* profile); | 222 static DevToolsWindow* CreateDevToolsWindowForWorker(Profile* profile); |
223 static DevToolsWindow* ToggleDevToolsWindow( | 223 static DevToolsWindow* ToggleDevToolsWindow( |
224 content::WebContents* web_contents, | 224 content::WebContents* web_contents, |
225 bool force_open, | 225 bool force_open, |
226 const DevToolsToggleAction& action, | 226 const DevToolsToggleAction& action, |
227 const std::string& settings); | 227 const std::string& settings); |
228 | 228 |
229 // content::WebContentsDelegate: | 229 // content::WebContentsDelegate: |
230 content::WebContents* OpenURLFromTab( | 230 content::WebContents* OpenURLFromTab( |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
307 base::Closure close_callback_; | 307 base::Closure close_callback_; |
308 | 308 |
309 base::TimeTicks inspect_element_start_time_; | 309 base::TimeTicks inspect_element_start_time_; |
310 scoped_ptr<DevToolsEventForwarder> event_forwarder_; | 310 scoped_ptr<DevToolsEventForwarder> event_forwarder_; |
311 | 311 |
312 friend class DevToolsEventForwarder; | 312 friend class DevToolsEventForwarder; |
313 DISALLOW_COPY_AND_ASSIGN(DevToolsWindow); | 313 DISALLOW_COPY_AND_ASSIGN(DevToolsWindow); |
314 }; | 314 }; |
315 | 315 |
316 #endif // CHROME_BROWSER_DEVTOOLS_DEVTOOLS_WINDOW_H_ | 316 #endif // CHROME_BROWSER_DEVTOOLS_DEVTOOLS_WINDOW_H_ |
OLD | NEW |