| OLD | NEW | 
| (Empty) |  | 
 |   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 | 
 |   3 // found in the LICENSE file. | 
 |   4  | 
 |   5 #ifndef CHROME_BROWSER_UI_UNLOAD_DETACHED_HANDLER_H_ | 
 |   6 #define CHROME_BROWSER_UI_UNLOAD_DETACHED_HANDLER_H_ | 
 |   7  | 
 |   8 #include "base/basictypes.h" | 
 |   9 #include "base/callback.h" | 
 |  10 #include "base/memory/scoped_vector.h" | 
 |  11  | 
 |  12 class TabStripModel; | 
 |  13  | 
 |  14 namespace content { | 
 |  15 class WebContents; | 
 |  16 } | 
 |  17  | 
 |  18 namespace chrome { | 
 |  19  | 
 |  20 class UnloadController; | 
 |  21  | 
 |  22 typedef base::Callback<void(void)> TabsClosedCallback; | 
 |  23  | 
 |  24 // UnloadDetachedHandler is used to close tabs quickly, http://crbug.com/142458. | 
 |  25 //   - Allows unload handlers to run in the background. | 
 |  26 //   - Comes into play after the beforeunload handlers (if any) have run. | 
 |  27 //   - Does not close the tabs; it holds tabs while they are closed. | 
 |  28 // | 
 |  29 // TODO(slamm): Support closes that destroy the browser: last tab close, window. | 
 |  30 //     http://crbug.com/156896 | 
 |  31 // TODO(slamm): Hide unload time from the user for cross-process navigations. | 
 |  32 //     http://crbug.com/156958 | 
 |  33 class UnloadDetachedHandler { | 
 |  34  public: | 
 |  35   explicit UnloadDetachedHandler(const TabsClosedCallback& callback); | 
 |  36   ~UnloadDetachedHandler(); | 
 |  37  | 
 |  38   // Returns true if is succeeds. | 
 |  39   bool DetachWebContents(TabStripModel* tab_strip_model, | 
 |  40                          content::WebContents* web_contents); | 
 |  41   bool HasTabs(); | 
 |  42  | 
 |  43  private: | 
 |  44   class WebContentsDelegateImpl; | 
 |  45  | 
 |  46   // Clean-up when the tab finishes closing. | 
 |  47   void Destroy(WebContentsDelegateImpl* delegate); | 
 |  48  | 
 |  49   const TabsClosedCallback tabs_closed_callback_; | 
 |  50  | 
 |  51   ScopedVector<WebContentsDelegateImpl> delegates_; | 
 |  52  | 
 |  53   DISALLOW_IMPLICIT_CONSTRUCTORS(UnloadDetachedHandler); | 
 |  54 }; | 
 |  55  | 
 |  56 }  // namespace chrome | 
 |  57  | 
 |  58 #endif  // CHROME_BROWSER_UI_UNLOAD_DETACHED_HANDLER_H_ | 
| OLD | NEW |