| 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_UNLOAD_CONTROLLER_H_ | 5 #ifndef CHROME_BROWSER_UI_UNLOAD_CONTROLLER_H_ |
| 6 #define CHROME_BROWSER_UI_UNLOAD_CONTROLLER_H_ | 6 #define CHROME_BROWSER_UI_UNLOAD_CONTROLLER_H_ |
| 7 | 7 |
| 8 #include <set> | 8 #include <set> |
| 9 | 9 |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 explicit UnloadController(Browser* browser); | 31 explicit UnloadController(Browser* browser); |
| 32 ~UnloadController() override; | 32 ~UnloadController() override; |
| 33 | 33 |
| 34 // Returns true if |contents| can be cleanly closed. When |browser_| is being | 34 // Returns true if |contents| can be cleanly closed. When |browser_| is being |
| 35 // closed, this function will return false to indicate |contents| should not | 35 // closed, this function will return false to indicate |contents| should not |
| 36 // be cleanly closed, since the fast shutdown path will just kill its | 36 // be cleanly closed, since the fast shutdown path will just kill its |
| 37 // renderer. | 37 // renderer. |
| 38 bool CanCloseContents(content::WebContents* contents); | 38 bool CanCloseContents(content::WebContents* contents); |
| 39 | 39 |
| 40 // Returns true if we need to run unload events for the |contents|. | 40 // Returns true if we need to run unload events for the |contents|. |
| 41 static bool ShouldRunUnloadEventsHelper(content::WebContents* contents); | 41 bool ShouldRunUnloadEventsHelper(content::WebContents* contents); |
| 42 | 42 |
| 43 // Helper function to run beforeunload listeners on a WebContents. | 43 // Helper function to run beforeunload listeners on a WebContents. |
| 44 // Returns true if |contents| beforeunload listeners were invoked. | 44 // Returns true if |contents| beforeunload listeners were invoked. |
| 45 static bool RunUnloadEventsHelper(content::WebContents* contents); | 45 bool RunUnloadEventsHelper(content::WebContents* contents); |
| 46 | 46 |
| 47 // Called when a BeforeUnload handler is fired for |contents|. |proceed| | 47 // Called when a BeforeUnload handler is fired for |contents|. |proceed| |
| 48 // indicates the user's response to the Y/N BeforeUnload handler dialog. If | 48 // indicates the user's response to the Y/N BeforeUnload handler dialog. If |
| 49 // this parameter is false, any pending attempt to close the whole browser | 49 // this parameter is false, any pending attempt to close the whole browser |
| 50 // will be canceled. Returns true if Unload handlers should be fired. When the | 50 // will be canceled. Returns true if Unload handlers should be fired. When the |
| 51 // |browser_| is being closed, Unload handlers for any particular WebContents | 51 // |browser_| is being closed, Unload handlers for any particular WebContents |
| 52 // will not be run until every WebContents being closed has a chance to run | 52 // will not be run until every WebContents being closed has a chance to run |
| 53 // its BeforeUnloadHandler. | 53 // its BeforeUnloadHandler. |
| 54 bool BeforeUnloadFired(content::WebContents* contents, bool proceed); | 54 bool BeforeUnloadFired(content::WebContents* contents, bool proceed); |
| 55 | 55 |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 155 base::Callback<void(bool)> on_close_confirmed_; | 155 base::Callback<void(bool)> on_close_confirmed_; |
| 156 | 156 |
| 157 base::WeakPtrFactory<UnloadController> weak_factory_; | 157 base::WeakPtrFactory<UnloadController> weak_factory_; |
| 158 | 158 |
| 159 DISALLOW_COPY_AND_ASSIGN(UnloadController); | 159 DISALLOW_COPY_AND_ASSIGN(UnloadController); |
| 160 }; | 160 }; |
| 161 | 161 |
| 162 } // namespace chrome | 162 } // namespace chrome |
| 163 | 163 |
| 164 #endif // CHROME_BROWSER_UI_UNLOAD_CONTROLLER_H_ | 164 #endif // CHROME_BROWSER_UI_UNLOAD_CONTROLLER_H_ |
| OLD | NEW |