Chromium Code Reviews| Index: chrome/browser/ui/browser.h |
| diff --git a/chrome/browser/ui/browser.h b/chrome/browser/ui/browser.h |
| index cd6244a52a458cbb5b432b05a1942619d9021894..44f54c02a3d719b3b40e1809004778b18b468fc4 100644 |
| --- a/chrome/browser/ui/browser.h |
| +++ b/chrome/browser/ui/browser.h |
| @@ -324,25 +324,30 @@ class Browser : public TabStripModelObserver, |
| // Gives beforeunload handlers the chance to cancel the close. Returns whether |
| // to proceed with the close. If called while the process begun by |
| - // CallBeforeUnloadHandlers is in progress, returns false without taking |
| - // action. |
| + // TryToCloseWindow is in progress, returns false without taking action. |
| bool ShouldCloseWindow(); |
| // Begins the process of confirming whether the associated browser can be |
| // closed. If there are no tabs with beforeunload handlers it will immediately |
| - // return false. Otherwise, it starts prompting the user, returns true and |
| - // will call |on_close_confirmed| with the result of the user's decision. |
| + // return false. If |skip_beforeunload| is true, all beforeunload |
| + // handlers will be skipped and window closing will be confirmed without |
| + // showing the prompt, the function will return false as well. |
| + // Otherwise, it starts prompting the user, returns true and will call |
| + // |on_close_confirmed| with the result of the user's decision. |
| // After calling this function, if the window will not be closed, call |
| // ResetBeforeUnloadHandlers() to reset all beforeunload handlers; calling |
| // this function multiple times without an intervening call to |
| - // ResetBeforeUnloadHandlers() will run only the beforeunload handlers |
| + // ResetTryToCloseWindow() will run only the beforeunload handlers |
| // registered since the previous call. |
| - bool CallBeforeUnloadHandlers( |
| - const base::Callback<void(bool)>& on_close_confirmed); |
| + // Note that if the browser window has been used before, user should always |
| + // has a chance to save his or her work before closing window without trigger |
|
Charlie Reis
2017/03/14 00:06:30
nit: s/has/have/
nit: before the window is closed
zmin
2017/03/14 17:46:47
Done.
|
| + // beforeunload event. |
| + bool TryToCloseWindow(bool skip_beforeunload, |
| + const base::Callback<void(bool)>& on_close_confirmed); |
| // Clears the results of any beforeunload confirmation dialogs triggered by a |
| - // CallBeforeUnloadHandlers call. |
| - void ResetBeforeUnloadHandlers(); |
| + // TryToCloseWindow call. |
| + void ResetTryToCloseWindow(); |
| // Figure out if there are tabs that have beforeunload handlers. |
| // It starts beforeunload/unload processing as a side-effect. |