| 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 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 | 179 |
| 180 // Notify devtools window that closing of |contents| was cancelled | 180 // Notify devtools window that closing of |contents| was cancelled |
| 181 // by user. | 181 // by user. |
| 182 static void OnPageCloseCanceled(content::WebContents* contents); | 182 static void OnPageCloseCanceled(content::WebContents* contents); |
| 183 | 183 |
| 184 private: | 184 private: |
| 185 friend class DevToolsControllerTest; | 185 friend class DevToolsControllerTest; |
| 186 friend class DevToolsSanityTest; | 186 friend class DevToolsSanityTest; |
| 187 friend class BrowserWindowControllerTest; | 187 friend class BrowserWindowControllerTest; |
| 188 | 188 |
| 189 // DevTools initialization typically follows this way: | 189 // DevTools lifecycle typically follows this way: |
| 190 // - Toggle/Open: client call; | 190 // - Toggle/Open: client call; |
| 191 // - Create; | 191 // - Create; |
| 192 // - ScheduleShow: setup window to be functional, but not yet show; | 192 // - ScheduleShow: setup window to be functional, but not yet show; |
| 193 // - DocumentOnLoadCompletedInMainFrame: frontend loaded; | 193 // - DocumentOnLoadCompletedInMainFrame: frontend loaded; |
| 194 // - SetIsDocked: frontend decided on docking state; | 194 // - SetIsDocked: frontend decided on docking state; |
| 195 // - OnLoadCompleted: ready to present frontend; | 195 // - OnLoadCompleted: ready to present frontend; |
| 196 // - Show: actually placing frontend WebContents to a Browser or docked place; | 196 // - Show: actually placing frontend WebContents to a Browser or docked place; |
| 197 // - DoAction: perform action passed in Toggle/Open. | 197 // - DoAction: perform action passed in Toggle/Open; |
| 198 enum LoadState { | 198 // - ...; |
| 199 // - CloseWindow: initiates before unload handling; |
| 200 // - CloseContents: destroys frontend; |
| 201 // - DevToolsWindow is dead once it's main_web_contents dies. |
| 202 enum LifeStage { |
| 199 kNotLoaded, | 203 kNotLoaded, |
| 200 kOnLoadFired, // Implies SetIsDocked was not yet called. | 204 kOnLoadFired, // Implies SetIsDocked was not yet called. |
| 201 kIsDockedSet, // Implies DocumentOnLoadCompleted was not yet called. | 205 kIsDockedSet, // Implies DocumentOnLoadCompleted was not yet called. |
| 202 kLoadCompleted | 206 kLoadCompleted, |
| 207 kClosing |
| 203 }; | 208 }; |
| 204 | 209 |
| 205 DevToolsWindow(Profile* profile, | 210 DevToolsWindow(Profile* profile, |
| 206 const GURL& frontend_url, | 211 const GURL& frontend_url, |
| 207 content::RenderViewHost* inspected_rvh, | 212 content::RenderViewHost* inspected_rvh, |
| 208 bool can_dock); | 213 bool can_dock); |
| 209 | 214 |
| 210 static DevToolsWindow* Create(Profile* profile, | 215 static DevToolsWindow* Create(Profile* profile, |
| 211 const GURL& frontend_url, | 216 const GURL& frontend_url, |
| 212 content::RenderViewHost* inspected_rvh, | 217 content::RenderViewHost* inspected_rvh, |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 299 | 304 |
| 300 scoped_ptr<ObserverWithAccessor> inspected_contents_observer_; | 305 scoped_ptr<ObserverWithAccessor> inspected_contents_observer_; |
| 301 | 306 |
| 302 Profile* profile_; | 307 Profile* profile_; |
| 303 content::WebContents* main_web_contents_; | 308 content::WebContents* main_web_contents_; |
| 304 content::WebContents* toolbox_web_contents_; | 309 content::WebContents* toolbox_web_contents_; |
| 305 DevToolsUIBindings* bindings_; | 310 DevToolsUIBindings* bindings_; |
| 306 Browser* browser_; | 311 Browser* browser_; |
| 307 bool is_docked_; | 312 bool is_docked_; |
| 308 const bool can_dock_; | 313 const bool can_dock_; |
| 309 LoadState load_state_; | 314 LifeStage life_stage_; |
| 310 DevToolsToggleAction action_on_load_; | 315 DevToolsToggleAction action_on_load_; |
| 311 bool ignore_set_is_docked_; | 316 bool ignore_set_is_docked_; |
| 312 DevToolsContentsResizingStrategy contents_resizing_strategy_; | 317 DevToolsContentsResizingStrategy contents_resizing_strategy_; |
| 313 // True if we're in the process of handling a beforeunload event originating | 318 // True if we're in the process of handling a beforeunload event originating |
| 314 // from the inspected webcontents, see InterceptPageBeforeUnload for details. | 319 // from the inspected webcontents, see InterceptPageBeforeUnload for details. |
| 315 bool intercepted_page_beforeunload_; | 320 bool intercepted_page_beforeunload_; |
| 316 base::Closure load_completed_callback_; | 321 base::Closure load_completed_callback_; |
| 317 | 322 |
| 318 base::TimeTicks inspect_element_start_time_; | 323 base::TimeTicks inspect_element_start_time_; |
| 319 scoped_ptr<DevToolsEventForwarder> event_forwarder_; | 324 scoped_ptr<DevToolsEventForwarder> event_forwarder_; |
| 320 | 325 |
| 321 friend class DevToolsEventForwarder; | 326 friend class DevToolsEventForwarder; |
| 322 DISALLOW_COPY_AND_ASSIGN(DevToolsWindow); | 327 DISALLOW_COPY_AND_ASSIGN(DevToolsWindow); |
| 323 }; | 328 }; |
| 324 | 329 |
| 325 #endif // CHROME_BROWSER_DEVTOOLS_DEVTOOLS_WINDOW_H_ | 330 #endif // CHROME_BROWSER_DEVTOOLS_DEVTOOLS_WINDOW_H_ |
| OLD | NEW |