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 "base/macros.h" | 8 #include "base/macros.h" |
9 #include "chrome/browser/devtools/devtools_contents_resizing_strategy.h" | 9 #include "chrome/browser/devtools/devtools_contents_resizing_strategy.h" |
10 #include "chrome/browser/devtools/devtools_toggle_action.h" | 10 #include "chrome/browser/devtools/devtools_toggle_action.h" |
(...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
199 static bool HasFiredBeforeUnloadEventForDevToolsBrowser(Browser* browser); | 199 static bool HasFiredBeforeUnloadEventForDevToolsBrowser(Browser* browser); |
200 | 200 |
201 // Returns true if devtools window would like to hook beforeunload event | 201 // Returns true if devtools window would like to hook beforeunload event |
202 // of this |contents|. | 202 // of this |contents|. |
203 static bool NeedsToInterceptBeforeUnload(content::WebContents* contents); | 203 static bool NeedsToInterceptBeforeUnload(content::WebContents* contents); |
204 | 204 |
205 // Notify devtools window that closing of |contents| was cancelled | 205 // Notify devtools window that closing of |contents| was cancelled |
206 // by user. | 206 // by user. |
207 static void OnPageCloseCanceled(content::WebContents* contents); | 207 static void OnPageCloseCanceled(content::WebContents* contents); |
208 | 208 |
| 209 content::WebContents* GetInspectedWebContents(); |
| 210 |
209 private: | 211 private: |
210 friend class DevToolsWindowTesting; | 212 friend class DevToolsWindowTesting; |
211 friend class DevToolsWindowCreationObserver; | 213 friend class DevToolsWindowCreationObserver; |
212 | 214 |
213 using CreationCallback = base::Callback<void(DevToolsWindow*)>; | 215 using CreationCallback = base::Callback<void(DevToolsWindow*)>; |
214 static void AddCreationCallbackForTest(const CreationCallback& callback); | 216 static void AddCreationCallbackForTest(const CreationCallback& callback); |
215 static void RemoveCreationCallbackForTest(const CreationCallback& callback); | 217 static void RemoveCreationCallbackForTest(const CreationCallback& callback); |
216 | 218 |
217 // DevTools lifecycle typically follows this way: | 219 // DevTools lifecycle typically follows this way: |
218 // - Toggle/Open: client call; | 220 // - Toggle/Open: client call; |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
312 void RenderProcessGone(bool crashed) override; | 314 void RenderProcessGone(bool crashed) override; |
313 | 315 |
314 void CreateDevToolsBrowser(); | 316 void CreateDevToolsBrowser(); |
315 BrowserWindow* GetInspectedBrowserWindow(); | 317 BrowserWindow* GetInspectedBrowserWindow(); |
316 void ScheduleShow(const DevToolsToggleAction& action); | 318 void ScheduleShow(const DevToolsToggleAction& action); |
317 void Show(const DevToolsToggleAction& action); | 319 void Show(const DevToolsToggleAction& action); |
318 void DoAction(const DevToolsToggleAction& action); | 320 void DoAction(const DevToolsToggleAction& action); |
319 void LoadCompleted(); | 321 void LoadCompleted(); |
320 void UpdateBrowserToolbar(); | 322 void UpdateBrowserToolbar(); |
321 void UpdateBrowserWindow(); | 323 void UpdateBrowserWindow(); |
322 content::WebContents* GetInspectedWebContents(); | |
323 | 324 |
324 scoped_ptr<ObserverWithAccessor> inspected_contents_observer_; | 325 scoped_ptr<ObserverWithAccessor> inspected_contents_observer_; |
325 | 326 |
326 Profile* profile_; | 327 Profile* profile_; |
327 content::WebContents* main_web_contents_; | 328 content::WebContents* main_web_contents_; |
328 content::WebContents* toolbox_web_contents_; | 329 content::WebContents* toolbox_web_contents_; |
329 DevToolsUIBindings* bindings_; | 330 DevToolsUIBindings* bindings_; |
330 Browser* browser_; | 331 Browser* browser_; |
331 bool is_docked_; | 332 bool is_docked_; |
332 const bool can_dock_; | 333 const bool can_dock_; |
333 LifeStage life_stage_; | 334 LifeStage life_stage_; |
334 DevToolsToggleAction action_on_load_; | 335 DevToolsToggleAction action_on_load_; |
335 DevToolsContentsResizingStrategy contents_resizing_strategy_; | 336 DevToolsContentsResizingStrategy contents_resizing_strategy_; |
336 // True if we're in the process of handling a beforeunload event originating | 337 // True if we're in the process of handling a beforeunload event originating |
337 // from the inspected webcontents, see InterceptPageBeforeUnload for details. | 338 // from the inspected webcontents, see InterceptPageBeforeUnload for details. |
338 bool intercepted_page_beforeunload_; | 339 bool intercepted_page_beforeunload_; |
339 base::Closure load_completed_callback_; | 340 base::Closure load_completed_callback_; |
340 base::Closure close_callback_; | 341 base::Closure close_callback_; |
341 bool ready_for_test_; | 342 bool ready_for_test_; |
342 base::Closure ready_for_test_callback_; | 343 base::Closure ready_for_test_callback_; |
343 | 344 |
344 base::TimeTicks inspect_element_start_time_; | 345 base::TimeTicks inspect_element_start_time_; |
345 scoped_ptr<DevToolsEventForwarder> event_forwarder_; | 346 scoped_ptr<DevToolsEventForwarder> event_forwarder_; |
346 | 347 |
347 friend class DevToolsEventForwarder; | 348 friend class DevToolsEventForwarder; |
348 DISALLOW_COPY_AND_ASSIGN(DevToolsWindow); | 349 DISALLOW_COPY_AND_ASSIGN(DevToolsWindow); |
349 }; | 350 }; |
350 | 351 |
351 #endif // CHROME_BROWSER_DEVTOOLS_DEVTOOLS_WINDOW_H_ | 352 #endif // CHROME_BROWSER_DEVTOOLS_DEVTOOLS_WINDOW_H_ |
OLD | NEW |