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_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 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <map> | 10 #include <map> |
| (...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 310 bool include_app_name, | 310 bool include_app_name, |
| 311 content::WebContents* contents) const; | 311 content::WebContents* contents) const; |
| 312 | 312 |
| 313 // Prepares a title string for display (removes embedded newlines, etc). | 313 // Prepares a title string for display (removes embedded newlines, etc). |
| 314 static void FormatTitleForDisplay(base::string16* title); | 314 static void FormatTitleForDisplay(base::string16* title); |
| 315 | 315 |
| 316 // OnBeforeUnload handling ////////////////////////////////////////////////// | 316 // OnBeforeUnload handling ////////////////////////////////////////////////// |
| 317 | 317 |
| 318 // Gives beforeunload handlers the chance to cancel the close. Returns whether | 318 // Gives beforeunload handlers the chance to cancel the close. Returns whether |
| 319 // to proceed with the close. If called while the process begun by | 319 // to proceed with the close. If called while the process begun by |
| 320 // CallBeforeUnloadHandlers is in progress, returns false without taking | 320 // TryToCloseWindow is in progress, returns false without taking action. |
| 321 // action. | |
| 322 bool ShouldCloseWindow(); | 321 bool ShouldCloseWindow(); |
| 323 | 322 |
| 324 // Begins the process of confirming whether the associated browser can be | 323 // Begins the process of confirming whether the associated browser can be |
| 325 // closed. If there are no tabs with beforeunload handlers it will immediately | 324 // closed. If there are no tabs with beforeunload handlers it will immediately |
| 326 // return false. Otherwise, it starts prompting the user, returns true and | 325 // return false. Otherwise, it starts prompting the user, returns true and |
| 327 // will call |on_close_confirmed| with the result of the user's decision. | 326 // will call |on_close_confirmed| with the result of the user's decision. If |
| 327 // |skip_before_unload_event| is true, beforeunload handlers will be skipped | |
| 328 // and window closing will be confirmed without showing the prompting. | |
|
sky
2017/02/13 23:12:53
prompting -> prompt
| |
| 328 // After calling this function, if the window will not be closed, call | 329 // After calling this function, if the window will not be closed, call |
| 329 // ResetBeforeUnloadHandlers() to reset all beforeunload handlers; calling | 330 // ResetBeforeUnloadHandlers() to reset all beforeunload handlers; calling |
| 330 // this function multiple times without an intervening call to | 331 // this function multiple times without an intervening call to |
| 331 // ResetBeforeUnloadHandlers() will run only the beforeunload handlers | 332 // ResetTryToCloseWindow() will run only the beforeunload handlers |
| 332 // registered since the previous call. | 333 // registered since the previous call. |
| 333 bool CallBeforeUnloadHandlers( | 334 bool TryToCloseWindow(bool skip_before_unload_event, |
| 334 const base::Callback<void(bool)>& on_close_confirmed); | 335 const base::Callback<void(bool)>& on_close_confirmed); |
| 335 | 336 |
| 336 // Clears the results of any beforeunload confirmation dialogs triggered by a | 337 // Clears the results of any beforeunload confirmation dialogs triggered by a |
| 337 // CallBeforeUnloadHandlers call. | 338 // TryToCloseWindow call. |
| 338 void ResetBeforeUnloadHandlers(); | 339 void ResetTryToCloseWindow(); |
| 339 | 340 |
| 340 // Figure out if there are tabs that have beforeunload handlers. | 341 // Figure out if there are tabs that have beforeunload handlers. |
| 341 // It starts beforeunload/unload processing as a side-effect. | 342 // It starts beforeunload/unload processing as a side-effect. |
| 342 bool TabsNeedBeforeUnloadFired(); | 343 bool TabsNeedBeforeUnloadFired(); |
| 343 | 344 |
| 344 // Returns true if all tabs' beforeunload/unload events have fired. | 345 // Returns true if all tabs' beforeunload/unload events have fired. |
| 345 bool HasCompletedUnloadProcessing() const; | 346 bool HasCompletedUnloadProcessing() const; |
| 346 | 347 |
| 347 bool IsAttemptingToCloseBrowser() const; | 348 bool IsAttemptingToCloseBrowser() const; |
| 348 | 349 |
| (...skipping 668 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1017 // The following factory is used for chrome update coalescing. | 1018 // The following factory is used for chrome update coalescing. |
| 1018 base::WeakPtrFactory<Browser> chrome_updater_factory_; | 1019 base::WeakPtrFactory<Browser> chrome_updater_factory_; |
| 1019 | 1020 |
| 1020 // The following factory is used to close the frame at a later time. | 1021 // The following factory is used to close the frame at a later time. |
| 1021 base::WeakPtrFactory<Browser> weak_factory_; | 1022 base::WeakPtrFactory<Browser> weak_factory_; |
| 1022 | 1023 |
| 1023 DISALLOW_COPY_AND_ASSIGN(Browser); | 1024 DISALLOW_COPY_AND_ASSIGN(Browser); |
| 1024 }; | 1025 }; |
| 1025 | 1026 |
| 1026 #endif // CHROME_BROWSER_UI_BROWSER_H_ | 1027 #endif // CHROME_BROWSER_UI_BROWSER_H_ |
| OLD | NEW |