Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(685)

Side by Side Diff: chrome/browser/ui/unload_detached_handler.h

Issue 11016023: Quickly close tabs/window with long-running unload handlers. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Add UnloadController class comment. Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(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();
Ben Goodger (Google) 2012/10/29 22:12:43 this kind of method can be const.
slamm 2012/10/31 18:03:59 Done.
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_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698