| 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 <set> | 8 #include <set> |
| 9 | 9 |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 public: | 57 public: |
| 58 explicit FastUnloadController(Browser* browser); | 58 explicit FastUnloadController(Browser* browser); |
| 59 virtual ~FastUnloadController(); | 59 virtual ~FastUnloadController(); |
| 60 | 60 |
| 61 // Returns true if |contents| can be cleanly closed. When |browser_| is being | 61 // Returns true if |contents| can be cleanly closed. When |browser_| is being |
| 62 // closed, this function will return false to indicate |contents| should not | 62 // closed, this function will return false to indicate |contents| should not |
| 63 // be cleanly closed, since the fast shutdown path will just kill its | 63 // be cleanly closed, since the fast shutdown path will just kill its |
| 64 // renderer. | 64 // renderer. |
| 65 bool CanCloseContents(content::WebContents* contents); | 65 bool CanCloseContents(content::WebContents* contents); |
| 66 | 66 |
| 67 // Returns true if we should allow fast shutdown for the given WebContents. |
| 68 static bool CanFastShutdownWebContents(content::WebContents* contents); |
| 69 |
| 67 // Helper function to run beforeunload listeners on a WebContents. | 70 // Helper function to run beforeunload listeners on a WebContents. |
| 68 // Returns true if |contents| beforeunload listeners were invoked. | 71 // Returns true if |contents| beforeunload listeners were invoked. |
| 69 static bool RunUnloadEventsHelper(content::WebContents* contents); | 72 static bool RunUnloadEventsHelper(content::WebContents* contents); |
| 70 | 73 |
| 71 // Called when a BeforeUnload handler is fired for |contents|. |proceed| | 74 // Called when a BeforeUnload handler is fired for |contents|. |proceed| |
| 72 // indicates the user's response to the Y/N BeforeUnload handler dialog. If | 75 // indicates the user's response to the Y/N BeforeUnload handler dialog. If |
| 73 // this parameter is false, any pending attempt to close the whole browser | 76 // this parameter is false, any pending attempt to close the whole browser |
| 74 // will be canceled. Returns true if Unload handlers should be fired. When the | 77 // will be canceled. Returns true if Unload handlers should be fired. When the |
| 75 // |browser_| is being closed, Unload handlers for any particular WebContents | 78 // |browser_| is being closed, Unload handlers for any particular WebContents |
| 76 // will not be run until every WebContents being closed has a chance to run | 79 // will not be run until every WebContents being closed has a chance to run |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 194 scoped_ptr<DetachedWebContentsDelegate> detached_delegate_; | 197 scoped_ptr<DetachedWebContentsDelegate> detached_delegate_; |
| 195 | 198 |
| 196 base::WeakPtrFactory<FastUnloadController> weak_factory_; | 199 base::WeakPtrFactory<FastUnloadController> weak_factory_; |
| 197 | 200 |
| 198 DISALLOW_COPY_AND_ASSIGN(FastUnloadController); | 201 DISALLOW_COPY_AND_ASSIGN(FastUnloadController); |
| 199 }; | 202 }; |
| 200 | 203 |
| 201 } // namespace chrome | 204 } // namespace chrome |
| 202 | 205 |
| 203 #endif // CHROME_BROWSER_UI_FAST_UNLOAD_CONTROLLER_H_ | 206 #endif // CHROME_BROWSER_UI_FAST_UNLOAD_CONTROLLER_H_ |
| OLD | NEW |