| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_FAST_UNLOAD_CONTROLLER_H_ | 5 #ifndef CHROME_BROWSER_UI_FAST_UNLOAD_CONTROLLER_H_ |
| 6 #define CHROME_BROWSER_UI_FAST_UNLOAD_CONTROLLER_H_ | 6 #define CHROME_BROWSER_UI_FAST_UNLOAD_CONTROLLER_H_ |
| 7 | 7 |
| 8 #include <memory> | 8 #include <memory> |
| 9 #include <set> | 9 #include <set> |
| 10 | 10 |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 explicit FastUnloadController(Browser* browser); | 59 explicit FastUnloadController(Browser* browser); |
| 60 ~FastUnloadController() override; | 60 ~FastUnloadController() override; |
| 61 | 61 |
| 62 // Returns true if |contents| can be cleanly closed. When |browser_| is being | 62 // Returns true if |contents| can be cleanly closed. When |browser_| is being |
| 63 // closed, this function will return false to indicate |contents| should not | 63 // closed, this function will return false to indicate |contents| should not |
| 64 // be cleanly closed, since the fast shutdown path will just kill its | 64 // be cleanly closed, since the fast shutdown path will just kill its |
| 65 // renderer. | 65 // renderer. |
| 66 bool CanCloseContents(content::WebContents* contents); | 66 bool CanCloseContents(content::WebContents* contents); |
| 67 | 67 |
| 68 // Returns true if we need to run unload events for the |contents|. | 68 // Returns true if we need to run unload events for the |contents|. |
| 69 static bool ShouldRunUnloadEventsHelper(content::WebContents* contents); | 69 bool ShouldRunUnloadEventsHelper(content::WebContents* contents); |
| 70 | 70 |
| 71 // Helper function to run beforeunload listeners on a WebContents. | 71 // Helper function to run beforeunload listeners on a WebContents. |
| 72 // Returns true if |contents| beforeunload listeners were invoked. | 72 // Returns true if |contents| beforeunload listeners were invoked. |
| 73 static bool RunUnloadEventsHelper(content::WebContents* contents); | 73 bool RunUnloadEventsHelper(content::WebContents* contents); |
| 74 | 74 |
| 75 // Called when a BeforeUnload handler is fired for |contents|. |proceed| | 75 // Called when a BeforeUnload handler is fired for |contents|. |proceed| |
| 76 // indicates the user's response to the Y/N BeforeUnload handler dialog. If | 76 // indicates the user's response to the Y/N BeforeUnload handler dialog. If |
| 77 // this parameter is false, any pending attempt to close the whole browser | 77 // this parameter is false, any pending attempt to close the whole browser |
| 78 // will be canceled. Returns true if Unload handlers should be fired. When the | 78 // will be canceled. Returns true if Unload handlers should be fired. When the |
| 79 // |browser_| is being closed, Unload handlers for any particular WebContents | 79 // |browser_| is being closed, Unload handlers for any particular WebContents |
| 80 // will not be run until every WebContents being closed has a chance to run | 80 // will not be run until every WebContents being closed has a chance to run |
| 81 // its BeforeUnloadHandler. | 81 // its BeforeUnloadHandler. |
| 82 bool BeforeUnloadFired(content::WebContents* contents, bool proceed); | 82 bool BeforeUnloadFired(content::WebContents* contents, bool proceed); |
| 83 | 83 |
| (...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 std::unique_ptr<DetachedWebContentsDelegate> detached_delegate_; | 197 std::unique_ptr<DetachedWebContentsDelegate> detached_delegate_; |
| 198 | 198 |
| 199 base::WeakPtrFactory<FastUnloadController> weak_factory_; | 199 base::WeakPtrFactory<FastUnloadController> weak_factory_; |
| 200 | 200 |
| 201 DISALLOW_COPY_AND_ASSIGN(FastUnloadController); | 201 DISALLOW_COPY_AND_ASSIGN(FastUnloadController); |
| 202 }; | 202 }; |
| 203 | 203 |
| 204 } // namespace chrome | 204 } // namespace chrome |
| 205 | 205 |
| 206 #endif // CHROME_BROWSER_UI_FAST_UNLOAD_CONTROLLER_H_ | 206 #endif // CHROME_BROWSER_UI_FAST_UNLOAD_CONTROLLER_H_ |
| OLD | NEW |