Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(355)

Side by Side Diff: chrome/browser/ui/browser.h

Issue 7466033: Fix warning prompting on closing a window that will cancel downloads. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merged up to latest (mostly around DownloadService changes. Created 9 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 FEATURE_TITLEBAR = 1, 101 FEATURE_TITLEBAR = 1,
102 FEATURE_TABSTRIP = 2, 102 FEATURE_TABSTRIP = 2,
103 FEATURE_TOOLBAR = 4, 103 FEATURE_TOOLBAR = 4,
104 FEATURE_LOCATIONBAR = 8, 104 FEATURE_LOCATIONBAR = 8,
105 FEATURE_BOOKMARKBAR = 16, 105 FEATURE_BOOKMARKBAR = 16,
106 FEATURE_INFOBAR = 32, 106 FEATURE_INFOBAR = 32,
107 FEATURE_SIDEBAR = 64, 107 FEATURE_SIDEBAR = 64,
108 FEATURE_DOWNLOADSHELF = 128 108 FEATURE_DOWNLOADSHELF = 128
109 }; 109 };
110 110
111 // The context for a download blocked notification from
112 // OkToCloseWithInProgressDownloads.
113 enum DownloadClosePreventionType {
114 // Browser close is not blocked by download state.
115 DOWNLOAD_CLOSE_OK,
116
117 // The browser is shutting down and there are active downloads
118 // that would be cancelled.
119 DOWNLOAD_CLOSE_BROWSER_SHUTDOWN,
120
121 // There are active downloads associated with this incognito profile
122 // that would be canceled.
123 DOWNLOAD_CLOSE_LAST_WINDOW_IN_INCOGNITO_PROFILE,
124 };
125
111 struct CreateParams { 126 struct CreateParams {
112 CreateParams(Type type, Profile* profile); 127 CreateParams(Type type, Profile* profile);
113 128
114 // The browser type. 129 // The browser type.
115 Type type; 130 Type type;
116 131
117 // The associated profile. 132 // The associated profile.
118 Profile* profile; 133 Profile* profile;
119 134
120 // The application name that is also the name of the window to the shell. 135 // The application name that is also the name of the window to the shell.
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
333 // cleanup. 348 // cleanup.
334 void OnWindowClosing(); 349 void OnWindowClosing();
335 350
336 // OnWindowActivationChanged handling /////////////////////////////////////// 351 // OnWindowActivationChanged handling ///////////////////////////////////////
337 352
338 // Invoked when the window containing us is activated. 353 // Invoked when the window containing us is activated.
339 void OnWindowActivated(); 354 void OnWindowActivated();
340 355
341 // In-progress download termination handling ///////////////////////////////// 356 // In-progress download termination handling /////////////////////////////////
342 357
343 // Are normal and/or incognito downloads in progress?
344 void CheckDownloadsInProgress(bool* normal_downloads,
345 bool* incognito_downloads);
346
347 // Called when the user has decided whether to proceed or not with the browser 358 // Called when the user has decided whether to proceed or not with the browser
348 // closure. |cancel_downloads| is true if the downloads should be canceled 359 // closure. |cancel_downloads| is true if the downloads should be canceled
349 // and the browser closed, false if the browser should stay open and the 360 // and the browser closed, false if the browser should stay open and the
350 // downloads running. 361 // downloads running.
351 void InProgressDownloadResponse(bool cancel_downloads); 362 void InProgressDownloadResponse(bool cancel_downloads);
352 363
364 // Indicates whether or not this browser window can be closed, or
365 // would be blocked by in-progress downloads.
366 // If executing downloads would be cancelled by this window close,
367 // then |*num_downloads_blocking| is updated with how many downloads
368 // would be canceled if the close continued.
369 DownloadClosePreventionType OkToCloseWithInProgressDownloads(
370 int* num_downloads_blocking) const;
371
353 // TabStripModel pass-thrus ///////////////////////////////////////////////// 372 // TabStripModel pass-thrus /////////////////////////////////////////////////
354 373
355 TabStripModel* tabstrip_model() const { 374 TabStripModel* tabstrip_model() const {
356 // TODO(beng): remove this accessor. It violates google style. 375 // TODO(beng): remove this accessor. It violates google style.
357 return tab_handler_->GetTabStripModel(); 376 return tab_handler_->GetTabStripModel();
358 } 377 }
359 378
360 int tab_count() const; 379 int tab_count() const;
361 int active_index() const; 380 int active_index() const;
362 int GetIndexOfController(const NavigationController* controller) const; 381 int GetIndexOfController(const NavigationController* controller) const;
(...skipping 1039 matching lines...) Expand 10 before | Expand all | Expand 10 after
1402 // True if the current tab entered fullscreen mode via webkitRequestFullScreen 1421 // True if the current tab entered fullscreen mode via webkitRequestFullScreen
1403 bool tab_caused_fullscreen_; 1422 bool tab_caused_fullscreen_;
1404 1423
1405 // True if the browser window has been shown at least once. 1424 // True if the browser window has been shown at least once.
1406 bool window_has_shown_; 1425 bool window_has_shown_;
1407 1426
1408 DISALLOW_COPY_AND_ASSIGN(Browser); 1427 DISALLOW_COPY_AND_ASSIGN(Browser);
1409 }; 1428 };
1410 1429
1411 #endif // CHROME_BROWSER_UI_BROWSER_H_ 1430 #endif // CHROME_BROWSER_UI_BROWSER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698