OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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_UI_BROWSER_H_ | 5 #ifndef CHROME_BROWSER_UI_BROWSER_H_ |
6 #define CHROME_BROWSER_UI_BROWSER_H_ | 6 #define CHROME_BROWSER_UI_BROWSER_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include <map> | 9 #include <map> |
10 #include <set> | 10 #include <set> |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 FEATURE_TITLEBAR = 1, | 96 FEATURE_TITLEBAR = 1, |
97 FEATURE_TABSTRIP = 2, | 97 FEATURE_TABSTRIP = 2, |
98 FEATURE_TOOLBAR = 4, | 98 FEATURE_TOOLBAR = 4, |
99 FEATURE_LOCATIONBAR = 8, | 99 FEATURE_LOCATIONBAR = 8, |
100 FEATURE_BOOKMARKBAR = 16, | 100 FEATURE_BOOKMARKBAR = 16, |
101 FEATURE_INFOBAR = 32, | 101 FEATURE_INFOBAR = 32, |
102 FEATURE_SIDEBAR = 64, | 102 FEATURE_SIDEBAR = 64, |
103 FEATURE_DOWNLOADSHELF = 128 | 103 FEATURE_DOWNLOADSHELF = 128 |
104 }; | 104 }; |
105 | 105 |
| 106 // The context for a download blocked notification from |
| 107 // OkToCloseWithInProgressDownloads. |
| 108 enum DownloadClosePreventionType { |
| 109 // Browser close is not blocked by download state. |
| 110 DOWNLOAD_CLOSE_OK, |
| 111 |
| 112 // The browser is shutting down and there are active downloads |
| 113 // that would be cancelled. |
| 114 DOWNLOAD_CLOSE_BROWSER_SHUTDOWN, |
| 115 |
| 116 // There are active downloads associated with this incognito profile |
| 117 // that would be canceled. |
| 118 DOWNLOAD_CLOSE_LAST_WINDOW_IN_INCOGNITO_PROFILE, |
| 119 }; |
| 120 |
106 struct CreateParams { | 121 struct CreateParams { |
107 CreateParams(Type type, Profile* profile); | 122 CreateParams(Type type, Profile* profile); |
108 | 123 |
109 // The browser type. | 124 // The browser type. |
110 Type type; | 125 Type type; |
111 | 126 |
112 // The associated profile. | 127 // The associated profile. |
113 Profile* profile; | 128 Profile* profile; |
114 | 129 |
115 // The application name that is also the name of the window to the shell. | 130 // The application name that is also the name of the window to the shell. |
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
325 // cleanup. | 340 // cleanup. |
326 void OnWindowClosing(); | 341 void OnWindowClosing(); |
327 | 342 |
328 // OnWindowActivationChanged handling /////////////////////////////////////// | 343 // OnWindowActivationChanged handling /////////////////////////////////////// |
329 | 344 |
330 // Invoked when the window containing us is activated. | 345 // Invoked when the window containing us is activated. |
331 void OnWindowActivated(); | 346 void OnWindowActivated(); |
332 | 347 |
333 // In-progress download termination handling ///////////////////////////////// | 348 // In-progress download termination handling ///////////////////////////////// |
334 | 349 |
335 // Are normal and/or incognito downloads in progress? | |
336 void CheckDownloadsInProgress(bool* normal_downloads, | |
337 bool* incognito_downloads); | |
338 | |
339 // Called when the user has decided whether to proceed or not with the browser | 350 // Called when the user has decided whether to proceed or not with the browser |
340 // closure. |cancel_downloads| is true if the downloads should be canceled | 351 // closure. |cancel_downloads| is true if the downloads should be canceled |
341 // and the browser closed, false if the browser should stay open and the | 352 // and the browser closed, false if the browser should stay open and the |
342 // downloads running. | 353 // downloads running. |
343 void InProgressDownloadResponse(bool cancel_downloads); | 354 void InProgressDownloadResponse(bool cancel_downloads); |
344 | 355 |
| 356 // Indicates whether or not this browser window can be closed, or |
| 357 // would be blocked by in-progress downloads. |
| 358 // If executing downloads would be cancelled by this window close, |
| 359 // then |*num_downloads_blocking| is updated with how many downloads |
| 360 // would be canceled if the close continued. |
| 361 DownloadClosePreventionType OkToCloseWithInProgressDownloads( |
| 362 int* num_downloads_blocking) const; |
| 363 |
345 // TabStripModel pass-thrus ///////////////////////////////////////////////// | 364 // TabStripModel pass-thrus ///////////////////////////////////////////////// |
346 | 365 |
347 TabStripModel* tabstrip_model() const { | 366 TabStripModel* tabstrip_model() const { |
348 // TODO(beng): remove this accessor. It violates google style. | 367 // TODO(beng): remove this accessor. It violates google style. |
349 return tab_handler_->GetTabStripModel(); | 368 return tab_handler_->GetTabStripModel(); |
350 } | 369 } |
351 | 370 |
352 int tab_count() const; | 371 int tab_count() const; |
353 int active_index() const; | 372 int active_index() const; |
354 int GetIndexOfController(const NavigationController* controller) const; | 373 int GetIndexOfController(const NavigationController* controller) const; |
(...skipping 921 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1276 | 1295 |
1277 scoped_ptr<InstantController> instant_; | 1296 scoped_ptr<InstantController> instant_; |
1278 scoped_ptr<InstantUnloadHandler> instant_unload_handler_; | 1297 scoped_ptr<InstantUnloadHandler> instant_unload_handler_; |
1279 | 1298 |
1280 BookmarkBar::State bookmark_bar_state_; | 1299 BookmarkBar::State bookmark_bar_state_; |
1281 | 1300 |
1282 DISALLOW_COPY_AND_ASSIGN(Browser); | 1301 DISALLOW_COPY_AND_ASSIGN(Browser); |
1283 }; | 1302 }; |
1284 | 1303 |
1285 #endif // CHROME_BROWSER_UI_BROWSER_H_ | 1304 #endif // CHROME_BROWSER_UI_BROWSER_H_ |
OLD | NEW |