Chromium Code Reviews| 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 <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 123 int GetHeight(int container_height); | 123 int GetHeight(int container_height); |
| 124 | 124 |
| 125 // Stores preferred devtools window width for this instance. | 125 // Stores preferred devtools window width for this instance. |
| 126 void SetWidth(int width); | 126 void SetWidth(int width); |
| 127 | 127 |
| 128 // Stores preferred devtools window height for this instance. | 128 // Stores preferred devtools window height for this instance. |
| 129 void SetHeight(int height); | 129 void SetHeight(int height); |
| 130 | 130 |
| 131 void Show(const DevToolsToggleAction& action); | 131 void Show(const DevToolsToggleAction& action); |
| 132 | 132 |
| 133 // DevTools window in undocked state doesn't receive beforeunload callback | |
| 134 // from its frontend webcontents as a browser is set as its delegate. | |
| 135 // This is a helper method to route callback to DevTools window. Returns | |
| 136 // true if routing was successful. | |
| 137 static bool HandleBeforeUnload(content::WebContents* contents, | |
|
jeremy
2013/11/10 12:50:30
What's missing from the comments in these function
lushnikov
2013/11/11 15:22:54
Done.
| |
| 138 bool proceed, | |
| 139 bool* proceed_to_fire_unload); | |
| 140 | |
| 141 // In order to preserve any edits the user may have made in devtools, the | |
| 142 // beforeunload event of inspected page is hooked - devtools gets the first | |
| 143 // shot at handling beforeunload and presents a dialog to the user. If the | |
| 144 // user accepts the dialog then the script is given a chance to handle it. | |
| 145 // This way 2 dialogs may be displayed: one from the devtools asking the user | |
| 146 // to confirm that they're ok with their edits going away and another from | |
| 147 // the webpage as the result of it's beforeunload handler. This function | |
| 148 // returns true if devtools window took responsobility for firing | |
| 149 // beforeunload events for inspected page. | |
|
jeremy
2013/11/10 12:50:30
I find this and the above function name a bit gene
lushnikov
2013/11/11 15:22:54
Do the additional comments bring some light on mot
| |
| 150 static bool InterceptPageBeforeUnload(content::WebContents* contents); | |
| 151 | |
| 152 // Returns true if DevTools browser window could be closed. | |
| 153 static bool ShouldCloseDevToolsBrowser(Browser* browser); | |
| 154 | |
| 155 // Returns true if DevTools window would like to hook beforeunload event | |
| 156 // of this |contents|. | |
| 157 static bool NeedToFireBeforeUnload(content::WebContents* contents); | |
|
jeremy
2013/11/10 12:50:30
Again, method name doesn't convey what's going on
lushnikov
2013/11/11 15:22:54
I pick "NeedsToInterceptBeforeUnload" :)
| |
| 158 | |
| 159 // Notify DevTools window that closing of |contents| was cancelled | |
| 160 // by used. | |
|
jeremy
2013/11/10 12:50:30
used -> user
lushnikov
2013/11/11 15:22:54
Done.
| |
| 161 static void OnPageCloseCanceled(content::WebContents* contents); | |
| 162 | |
| 163 void SetDockSideForTest(DevToolsDockSide dock_side); | |
| 164 | |
| 133 private: | 165 private: |
| 134 friend class DevToolsControllerTest; | 166 friend class DevToolsControllerTest; |
| 135 | 167 |
| 136 DevToolsWindow(Profile* profile, | 168 DevToolsWindow(Profile* profile, |
| 137 const GURL& frontend_url, | 169 const GURL& frontend_url, |
| 138 content::RenderViewHost* inspected_rvh, | 170 content::RenderViewHost* inspected_rvh, |
| 139 DevToolsDockSide dock_side); | 171 DevToolsDockSide dock_side); |
| 140 | 172 |
| 141 static DevToolsWindow* Create(Profile* profile, | 173 static DevToolsWindow* Create(Profile* profile, |
| 142 const GURL& frontend_url, | 174 const GURL& frontend_url, |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 274 scoped_ptr<DevToolsFileHelper> file_helper_; | 306 scoped_ptr<DevToolsFileHelper> file_helper_; |
| 275 scoped_refptr<DevToolsFileSystemIndexer> file_system_indexer_; | 307 scoped_refptr<DevToolsFileSystemIndexer> file_system_indexer_; |
| 276 typedef std::map< | 308 typedef std::map< |
| 277 int, | 309 int, |
| 278 scoped_refptr<DevToolsFileSystemIndexer::FileSystemIndexingJob> > | 310 scoped_refptr<DevToolsFileSystemIndexer::FileSystemIndexingJob> > |
| 279 IndexingJobsMap; | 311 IndexingJobsMap; |
| 280 IndexingJobsMap indexing_jobs_; | 312 IndexingJobsMap indexing_jobs_; |
| 281 int width_; | 313 int width_; |
| 282 int height_; | 314 int height_; |
| 283 DevToolsDockSide dock_side_before_minimized_; | 315 DevToolsDockSide dock_side_before_minimized_; |
| 316 bool inspected_page_is_closing_; | |
| 284 | 317 |
| 285 scoped_ptr<DevToolsEmbedderMessageDispatcher> embedder_message_dispatcher_; | 318 scoped_ptr<DevToolsEmbedderMessageDispatcher> embedder_message_dispatcher_; |
| 286 base::WeakPtrFactory<DevToolsWindow> weak_factory_; | 319 base::WeakPtrFactory<DevToolsWindow> weak_factory_; |
| 287 DISALLOW_COPY_AND_ASSIGN(DevToolsWindow); | 320 DISALLOW_COPY_AND_ASSIGN(DevToolsWindow); |
| 288 }; | 321 }; |
| 289 | 322 |
| 290 #endif // CHROME_BROWSER_DEVTOOLS_DEVTOOLS_WINDOW_H_ | 323 #endif // CHROME_BROWSER_DEVTOOLS_DEVTOOLS_WINDOW_H_ |
| OLD | NEW |