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

Side by Side Diff: chrome/browser/instant/instant_unload_handler.h

Issue 5610005: Makes instant run before unload listeners. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/chrome
Patch Set: Addresses review comments Created 10 years 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) 2010 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_INSTANT_INSTANT_UNLOAD_HANDLER_H_
6 #define CHROME_BROWSER_INSTANT_INSTANT_UNLOAD_HANDLER_H_
7 #pragma once
8
9 #include "base/scoped_vector.h"
10
11 class Browser;
12 class TabContentsWrapper;
13
14 // InstantUnloadHandler makes sure the before unload and unloader handler is run
Charlie Reis 2010/12/08 05:50:11 nit: unloader -> unload This comment is much bett
15 // when using instant. When the user commits the instant preview the existing
16 // TabContentsWrapper is passed to |Own|. If the tab has no before unload or
17 // unload listener the tab is deleted, otherwise the before unload and unload
18 // listener is executed. If the before unload listener shows a dialog the tab is
19 // added back to the tabstrip at its original location next to the instant page.
20 class InstantUnloadHandler {
21 public:
22 explicit InstantUnloadHandler(Browser* browser);
23 ~InstantUnloadHandler();
24
25 // See class description for details on what this does.
26 void Own(TabContentsWrapper* tab_contents, int index);
27
28 private:
29 class TabContentsDelegateImpl;
30
31 // Invoked if the tab is to be shown. This happens if the before unload
32 // listener returns a string.
33 void Activate(TabContentsDelegateImpl* delegate);
34
35 // Destroys the old tab. This is invoked if script tries to close the page.
36 void Destroy(TabContentsDelegateImpl* delegate);
37
38 // TODO(sky): browser really needs to wait to close until there are no more
39 // tabs managed by InstantUnloadHandler.
40 Browser* browser_;
41
42 ScopedVector<TabContentsDelegateImpl> delegates_;
43
44 DISALLOW_COPY_AND_ASSIGN(InstantUnloadHandler);
45 };
46
47 #endif // CHROME_BROWSER_INSTANT_INSTANT_UNLOAD_HANDLER_H_
OLDNEW
« no previous file with comments | « chrome/browser/instant/instant_browsertest.cc ('k') | chrome/browser/instant/instant_unload_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698