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

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

Issue 11421079: Persist the Instant API to committed search result pages. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: More fixes Created 8 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
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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" 8 #include "base/basictypes.h"
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "base/prefs/public/pref_change_registrar.h" 10 #include "base/prefs/public/pref_change_registrar.h"
11 #include "chrome/browser/instant/instant_controller.h" 11 #include "chrome/browser/instant/instant_controller.h"
12 #include "chrome/browser/instant/instant_unload_handler.h" 12 #include "chrome/browser/instant/instant_unload_handler.h"
13 #include "chrome/browser/ui/search/search_model_observer.h" 13 #include "chrome/browser/ui/search/search_model_observer.h"
14 #include "content/public/browser/notification_observer.h" 14 #include "content/public/browser/notification_observer.h"
15 #include "content/public/browser/notification_registrar.h" 15 #include "content/public/browser/notification_registrar.h"
16 #include "webkit/glue/window_open_disposition.h" 16 #include "webkit/glue/window_open_disposition.h"
17 17
18 class Browser; 18 class Browser;
19 struct InstantSuggestion; 19 struct InstantSuggestion;
20 class PrefService; 20 class PrefService;
21 class Profile; 21 class Profile;
22 class TabContents;
23 class ThemeService; 22 class ThemeService;
24 23
24 namespace content {
25 class WebContents;
26 }
27
25 namespace gfx { 28 namespace gfx {
26 class Rect; 29 class Rect;
27 } 30 }
28 31
29 namespace chrome { 32 namespace chrome {
30 33
31 class BrowserInstantController : public content::NotificationObserver, 34 class BrowserInstantController : public content::NotificationObserver,
32 public search::SearchModelObserver { 35 public search::SearchModelObserver {
33 public: 36 public:
34 explicit BrowserInstantController(Browser* browser); 37 explicit BrowserInstantController(Browser* browser);
35 virtual ~BrowserInstantController(); 38 virtual ~BrowserInstantController();
36 39
37 // Returns true if Instant is enabled in a visible, preview-showing mode. 40 // Returns true if Instant is enabled in a visible, preview-showing mode.
38 static bool IsInstantEnabled(Profile* profile); 41 static bool IsInstantEnabled(Profile* profile);
39 42
40 // Registers Instant related preferences. 43 // Registers Instant related preferences.
41 static void RegisterUserPrefs(PrefService* prefs); 44 static void RegisterUserPrefs(PrefService* prefs);
42 45
43 // Commits the current Instant, returning true on success. This is intended 46 // Commits the current Instant, returning true on success. This is intended
44 // for use from OpenCurrentURL. 47 // for use from OpenCurrentURL.
45 bool OpenInstant(WindowOpenDisposition disposition); 48 bool OpenInstant(WindowOpenDisposition disposition);
46 49
47 // Returns the InstantController or NULL if there is no InstantController for 50 // Returns the InstantController or NULL if there is no InstantController for
48 // this BrowserInstantController. 51 // this BrowserInstantController.
49 InstantController* instant() { return &instant_; } 52 InstantController* instant() { return &instant_; }
50 53
51 // Invoked by |instant_| to commit the |preview| by merging it into the active 54 // Invoked by |instant_| to commit the |preview| by merging it into the active
52 // tab or adding it as a new tab. We take ownership of |preview|. 55 // tab or adding it as a new tab. We take ownership of |preview|.
53 void CommitInstant(TabContents* preview, bool in_new_tab); 56 void CommitInstant(content::WebContents* preview, bool in_new_tab);
54 57
55 // Invoked by |instant_| to autocomplete the |suggestion| into the omnibox. 58 // Invoked by |instant_| to autocomplete the |suggestion| into the omnibox.
56 void SetInstantSuggestion(const InstantSuggestion& suggestion); 59 void SetInstantSuggestion(const InstantSuggestion& suggestion);
57 60
58 // Invoked by |instant_| to get the bounds that the preview is placed at, 61 // Invoked by |instant_| to get the bounds that the preview is placed at,
59 // in screen coordinated. 62 // in screen coordinated.
60 gfx::Rect GetInstantBounds(); 63 gfx::Rect GetInstantBounds();
61 64
62 // Invoked by |instant_| to notify that the preview gained focus, usually due 65 // Invoked by |instant_| to notify that the preview gained focus, usually due
63 // to the user clicking on it. 66 // to the user clicking on it.
64 void InstantPreviewFocused(); 67 void InstantPreviewFocused();
65 68
66 // Invoked by |instant_| to get the currently active tab, over which the 69 // Invoked by |instant_| to get the currently active tab, over which the
67 // preview would be shown. 70 // preview would be shown.
68 TabContents* GetActiveTabContents() const; 71 content::WebContents* GetActiveWebContents() const;
69 72
70 // Invoked by |browser_| when the active tab changes. 73 // Invoked by |browser_| when the active tab changes.
71 void ActiveTabChanged(); 74 void ActiveTabChanged();
72 75
73 // Invoked by |BrowserWindow| during layout to set content height which is 76 // Invoked by |BrowserWindow| during layout to set content height which is
74 // used as theme area height, i.e. the height of the area that the entire 77 // used as theme area height, i.e. the height of the area that the entire
75 // theme background image should fill up. 78 // theme background image should fill up.
76 void SetContentHeight(int height); 79 void SetContentHeight(int height);
77 80
78 // Invoked by |instant_| to update theme information for preview. 81 // Invoked by |instant_| to update theme information for preview.
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 PrefChangeRegistrar profile_pref_registrar_; 114 PrefChangeRegistrar profile_pref_registrar_;
112 115
113 content::NotificationRegistrar registrar_; 116 content::NotificationRegistrar registrar_;
114 117
115 DISALLOW_COPY_AND_ASSIGN(BrowserInstantController); 118 DISALLOW_COPY_AND_ASSIGN(BrowserInstantController);
116 }; 119 };
117 120
118 } // namespace chrome 121 } // namespace chrome
119 122
120 #endif // CHROME_BROWSER_UI_BROWSER_INSTANT_CONTROLLER_H_ 123 #endif // CHROME_BROWSER_UI_BROWSER_INSTANT_CONTROLLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698