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

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

Issue 10836031: Remove Instant v1 API. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 4 months 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
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 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 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_BROWSER_INSTANT_CONTROLLER_H_ 5 #ifndef CHROME_BROWSER_UI_BROWSER_INSTANT_CONTROLLER_H_
6 #define CHROME_BROWSER_UI_BROWSER_INSTANT_CONTROLLER_H_ 6 #define CHROME_BROWSER_UI_BROWSER_INSTANT_CONTROLLER_H_
7 7
8 #include "base/basictypes.h"
9 #include "base/compiler_specific.h"
8 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
11 #include "base/string16.h"
9 #include "chrome/browser/instant/instant_controller_delegate.h" 12 #include "chrome/browser/instant/instant_controller_delegate.h"
10 #include "chrome/browser/prefs/pref_change_registrar.h" 13 #include "chrome/browser/prefs/pref_change_registrar.h"
11 #include "chrome/browser/ui/tabs/tab_strip_model_observer.h" 14 #include "chrome/browser/ui/tabs/tab_strip_model_observer.h"
15 #include "chrome/common/instant_types.h"
12 #include "content/public/browser/notification_observer.h" 16 #include "content/public/browser/notification_observer.h"
13 #include "webkit/glue/window_open_disposition.h" 17 #include "webkit/glue/window_open_disposition.h"
14 18
15 class Browser; 19 class Browser;
16 class InstantController; 20 class InstantController;
21 class InstantTest;
17 class InstantUnloadHandler; 22 class InstantUnloadHandler;
18 class TabContents; 23 class TabContents;
19 24
25 namespace content {
26 class NotificationDetails;
27 class NotificationSource;
28 }
29
30 namespace gfx {
31 class Rect;
32 }
33
20 namespace chrome { 34 namespace chrome {
21 35
22 class BrowserInstantController : public InstantControllerDelegate, 36 class BrowserInstantController : public InstantControllerDelegate,
23 public TabStripModelObserver, 37 public TabStripModelObserver,
24 public content::NotificationObserver { 38 public content::NotificationObserver {
25 public: 39 public:
26 explicit BrowserInstantController(Browser* browser); 40 explicit BrowserInstantController(Browser* browser);
27 virtual ~BrowserInstantController(); 41 virtual ~BrowserInstantController();
28 42
29 // Commits the current instant, returning true on success. This is intended 43 // Commits the current Instant, returning true on success. This is intended
30 // for use from OpenCurrentURL. 44 // for use from OpenCurrentURL.
31 bool OpenInstant(WindowOpenDisposition disposition); 45 bool OpenInstant(WindowOpenDisposition disposition);
32 46
33 // Returns the InstantController or NULL if there is no InstantController for 47 // Returns the InstantController or NULL if there is no InstantController for
34 // this BrowserInstantController. 48 // this BrowserInstantController.
35 InstantController* instant() const { return instant_.get(); } 49 InstantController* instant() const { return instant_.get(); }
36 50
37 private: 51 private:
52 friend class InstantTest;
53
38 // Overridden from InstantControllerDelegate: 54 // Overridden from InstantControllerDelegate:
39 virtual void ShowInstant(TabContents* preview_contents) OVERRIDE; 55 virtual void ShowInstant() OVERRIDE;
40 virtual void HideInstant() OVERRIDE; 56 virtual void HideInstant() OVERRIDE;
41 virtual void CommitInstant(TabContents* preview_contents) OVERRIDE; 57 virtual void CommitInstant(TabContents* preview) OVERRIDE;
42 virtual void SetSuggestedText(const string16& text, 58 virtual void SetSuggestedText(const string16& text,
43 InstantCompleteBehavior behavior) OVERRIDE; 59 InstantCompleteBehavior behavior) OVERRIDE;
44 virtual gfx::Rect GetInstantBounds() OVERRIDE; 60 virtual gfx::Rect GetInstantBounds() OVERRIDE;
45 virtual void InstantPreviewFocused() OVERRIDE; 61 virtual void InstantPreviewFocused() OVERRIDE;
46 virtual TabContents* GetInstantHostTabContents() const OVERRIDE; 62 virtual TabContents* GetActiveTabContents() const OVERRIDE;
47 63
48 // Overridden from content::NotificationObserver: 64 // Overridden from content::NotificationObserver:
49 virtual void Observe(int type, 65 virtual void Observe(int type,
50 const content::NotificationSource& source, 66 const content::NotificationSource& source,
51 const content::NotificationDetails& details) OVERRIDE; 67 const content::NotificationDetails& details) OVERRIDE;
52 68
53 // Overridden from TabStripModelObserver: 69 // Overridden from TabStripModelObserver:
54 virtual void TabDeactivated(TabContents* contents) OVERRIDE; 70 virtual void TabDeactivated(TabContents* contents) OVERRIDE;
55 71
56 // If this browser should have instant one is created, otherwise does nothing. 72 // If this browser should have Instant, a new InstantController created;
57 void CreateInstantIfNecessary(); 73 // otherwise any existing InstantController is destroyed.
74 void ResetInstant();
58 75
59 Browser* browser_; 76 Browser* browser_;
60 77
61 scoped_ptr<InstantController> instant_; 78 scoped_ptr<InstantController> instant_;
62 scoped_ptr<InstantUnloadHandler> instant_unload_handler_; 79 scoped_ptr<InstantUnloadHandler> instant_unload_handler_;
63 80
64 PrefChangeRegistrar profile_pref_registrar_; 81 PrefChangeRegistrar profile_pref_registrar_;
65 82
66 DISALLOW_COPY_AND_ASSIGN(BrowserInstantController); 83 DISALLOW_COPY_AND_ASSIGN(BrowserInstantController);
67 }; 84 };
68 85
69 } // namespace chrome 86 } // namespace chrome
70 87
71 #endif // CHROME_BROWSER_UI_BROWSER_INSTANT_CONTROLLER_H_ 88 #endif // CHROME_BROWSER_UI_BROWSER_INSTANT_CONTROLLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698