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

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: Various fixes related to try jobs. Created 9 years, 4 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 97 matching lines...) Expand 10 before | Expand all | Expand 10 after
108 // what the user has done. 108 // what the user has done.
109 MAXIMIZED_STATE_DEFAULT, 109 MAXIMIZED_STATE_DEFAULT,
110 110
111 // Maximized state is explicitly maximized. 111 // Maximized state is explicitly maximized.
112 MAXIMIZED_STATE_MAXIMIZED, 112 MAXIMIZED_STATE_MAXIMIZED,
113 113
114 // Maximized state is explicitly not maximized (normal). 114 // Maximized state is explicitly not maximized (normal).
115 MAXIMIZED_STATE_UNMAXIMIZED 115 MAXIMIZED_STATE_UNMAXIMIZED
116 }; 116 };
117 117
118 // The context for a download blocked notification from
119 // OkToCloseWithInProgressDownloads.
120 enum DownloadClosePreventionType {
121 // Browser close is not blocked by download state.
122 DOWNLOAD_CLOSE_OK,
123
124 // The browser is shutting down and there are active downloads
125 // that would be cancelled.
126 DOWNLOAD_CLOSE_BROWSER_SHUTDOWN,
127
128 // There are active downloads associated with this incognito profile
129 // that would be canceled.
130 DOWNLOAD_CLOSE_LAST_WINDOW_IN_INCOGNITO_PROFILE,
131 };
132
118 struct CreateParams { 133 struct CreateParams {
119 CreateParams(Type type, Profile* profile); 134 CreateParams(Type type, Profile* profile);
120 135
121 // The browser type. 136 // The browser type.
122 Type type; 137 Type type;
123 138
124 // The associated profile. 139 // The associated profile.
125 Profile* profile; 140 Profile* profile;
126 141
127 // The application name that is also the name of the window to the shell. 142 // The application name that is also the name of the window to the shell.
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
341 // cleanup. 356 // cleanup.
342 void OnWindowClosing(); 357 void OnWindowClosing();
343 358
344 // OnWindowActivationChanged handling /////////////////////////////////////// 359 // OnWindowActivationChanged handling ///////////////////////////////////////
345 360
346 // Invoked when the window containing us is activated. 361 // Invoked when the window containing us is activated.
347 void OnWindowActivated(); 362 void OnWindowActivated();
348 363
349 // In-progress download termination handling ///////////////////////////////// 364 // In-progress download termination handling /////////////////////////////////
350 365
351 // Are normal and/or incognito downloads in progress?
352 void CheckDownloadsInProgress(bool* normal_downloads,
353 bool* incognito_downloads);
354
355 // Called when the user has decided whether to proceed or not with the browser 366 // Called when the user has decided whether to proceed or not with the browser
356 // closure. |cancel_downloads| is true if the downloads should be canceled 367 // closure. |cancel_downloads| is true if the downloads should be canceled
357 // and the browser closed, false if the browser should stay open and the 368 // and the browser closed, false if the browser should stay open and the
358 // downloads running. 369 // downloads running.
359 void InProgressDownloadResponse(bool cancel_downloads); 370 void InProgressDownloadResponse(bool cancel_downloads);
360 371
372 // Indicates whether or not this browser window can be closed, or
373 // would be blocked by in-progress downloads.
374 // If executing downloads would be cancelled by this window close,
375 // then |*num_downloads_blocking| is updated with how many downloads
376 // would be canceled if the close continued.
377 DownloadClosePreventionType OkToCloseWithInProgressDownloads(
378 int* num_downloads_blocking) const;
379
361 // TabStripModel pass-thrus ///////////////////////////////////////////////// 380 // TabStripModel pass-thrus /////////////////////////////////////////////////
362 381
363 TabStripModel* tabstrip_model() const { 382 TabStripModel* tabstrip_model() const {
364 // TODO(beng): remove this accessor. It violates google style. 383 // TODO(beng): remove this accessor. It violates google style.
365 return tab_handler_->GetTabStripModel(); 384 return tab_handler_->GetTabStripModel();
366 } 385 }
367 386
368 int tab_count() const; 387 int tab_count() const;
369 int active_index() const; 388 int active_index() const;
370 int GetIndexOfController(const NavigationController* controller) const; 389 int GetIndexOfController(const NavigationController* controller) const;
(...skipping 909 matching lines...) Expand 10 before | Expand all | Expand 10 after
1280 1299
1281 scoped_ptr<InstantController> instant_; 1300 scoped_ptr<InstantController> instant_;
1282 scoped_ptr<InstantUnloadHandler> instant_unload_handler_; 1301 scoped_ptr<InstantUnloadHandler> instant_unload_handler_;
1283 1302
1284 BookmarkBar::State bookmark_bar_state_; 1303 BookmarkBar::State bookmark_bar_state_;
1285 1304
1286 DISALLOW_COPY_AND_ASSIGN(Browser); 1305 DISALLOW_COPY_AND_ASSIGN(Browser);
1287 }; 1306 };
1288 1307
1289 #endif // CHROME_BROWSER_UI_BROWSER_H_ 1308 #endif // CHROME_BROWSER_UI_BROWSER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698