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

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: Make sure to use temporary download directory 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
« no previous file with comments | « chrome/browser/download/download_test_observer.cc ('k') | chrome/browser/ui/browser.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 FEATURE_TITLEBAR = 1, 103 FEATURE_TITLEBAR = 1,
104 FEATURE_TABSTRIP = 2, 104 FEATURE_TABSTRIP = 2,
105 FEATURE_TOOLBAR = 4, 105 FEATURE_TOOLBAR = 4,
106 FEATURE_LOCATIONBAR = 8, 106 FEATURE_LOCATIONBAR = 8,
107 FEATURE_BOOKMARKBAR = 16, 107 FEATURE_BOOKMARKBAR = 16,
108 FEATURE_INFOBAR = 32, 108 FEATURE_INFOBAR = 32,
109 FEATURE_SIDEBAR = 64, 109 FEATURE_SIDEBAR = 64,
110 FEATURE_DOWNLOADSHELF = 128 110 FEATURE_DOWNLOADSHELF = 128
111 }; 111 };
112 112
113 // The context for a download blocked notification from
114 // OkToCloseWithInProgressDownloads.
115 enum DownloadClosePreventionType {
116 // Browser close is not blocked by download state.
117 DOWNLOAD_CLOSE_OK,
118
119 // The browser is shutting down and there are active downloads
120 // that would be cancelled.
121 DOWNLOAD_CLOSE_BROWSER_SHUTDOWN,
122
123 // There are active downloads associated with this incognito profile
124 // that would be canceled.
125 DOWNLOAD_CLOSE_LAST_WINDOW_IN_INCOGNITO_PROFILE,
126 };
127
113 struct CreateParams { 128 struct CreateParams {
114 CreateParams(Type type, Profile* profile); 129 CreateParams(Type type, Profile* profile);
115 130
116 // The browser type. 131 // The browser type.
117 Type type; 132 Type type;
118 133
119 // The associated profile. 134 // The associated profile.
120 Profile* profile; 135 Profile* profile;
121 136
122 // The application name that is also the name of the window to the shell. 137 // 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
335 // cleanup. 350 // cleanup.
336 void OnWindowClosing(); 351 void OnWindowClosing();
337 352
338 // OnWindowActivationChanged handling /////////////////////////////////////// 353 // OnWindowActivationChanged handling ///////////////////////////////////////
339 354
340 // Invoked when the window containing us is activated. 355 // Invoked when the window containing us is activated.
341 void OnWindowActivated(); 356 void OnWindowActivated();
342 357
343 // In-progress download termination handling ///////////////////////////////// 358 // In-progress download termination handling /////////////////////////////////
344 359
345 // Are normal and/or incognito downloads in progress?
346 void CheckDownloadsInProgress(bool* normal_downloads,
347 bool* incognito_downloads);
348
349 // Called when the user has decided whether to proceed or not with the browser 360 // Called when the user has decided whether to proceed or not with the browser
350 // closure. |cancel_downloads| is true if the downloads should be canceled 361 // closure. |cancel_downloads| is true if the downloads should be canceled
351 // and the browser closed, false if the browser should stay open and the 362 // and the browser closed, false if the browser should stay open and the
352 // downloads running. 363 // downloads running.
353 void InProgressDownloadResponse(bool cancel_downloads); 364 void InProgressDownloadResponse(bool cancel_downloads);
354 365
366 // Indicates whether or not this browser window can be closed, or
367 // would be blocked by in-progress downloads.
368 // If executing downloads would be cancelled by this window close,
369 // then |*num_downloads_blocking| is updated with how many downloads
370 // would be canceled if the close continued.
371 DownloadClosePreventionType OkToCloseWithInProgressDownloads(
372 int* num_downloads_blocking) const;
373
355 // TabStripModel pass-thrus ///////////////////////////////////////////////// 374 // TabStripModel pass-thrus /////////////////////////////////////////////////
356 375
357 TabStripModel* tabstrip_model() const { 376 TabStripModel* tabstrip_model() const {
358 // TODO(beng): remove this accessor. It violates google style. 377 // TODO(beng): remove this accessor. It violates google style.
359 return tab_handler_->GetTabStripModel(); 378 return tab_handler_->GetTabStripModel();
360 } 379 }
361 380
362 int tab_count() const; 381 int tab_count() const;
363 int active_index() const; 382 int active_index() const;
364 int GetIndexOfController(const NavigationController* controller) const; 383 int GetIndexOfController(const NavigationController* controller) const;
(...skipping 1069 matching lines...) Expand 10 before | Expand all | Expand 10 after
1434 1453
1435 MouseLockState mouse_lock_state_; 1454 MouseLockState mouse_lock_state_;
1436 1455
1437 // True if the browser window has been shown at least once. 1456 // True if the browser window has been shown at least once.
1438 bool window_has_shown_; 1457 bool window_has_shown_;
1439 1458
1440 DISALLOW_COPY_AND_ASSIGN(Browser); 1459 DISALLOW_COPY_AND_ASSIGN(Browser);
1441 }; 1460 };
1442 1461
1443 #endif // CHROME_BROWSER_UI_BROWSER_H_ 1462 #endif // CHROME_BROWSER_UI_BROWSER_H_
OLDNEW
« no previous file with comments | « chrome/browser/download/download_test_observer.cc ('k') | chrome/browser/ui/browser.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698