OLD | NEW |
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 "ui/base/window_open_disposition.h" | 16 #include "ui/base/window_open_disposition.h" |
17 | 17 |
18 class Browser; | 18 class Browser; |
19 struct InstantSuggestion; | 19 struct InstantSuggestion; |
20 class PrefServiceSyncable; | 20 class PrefRegistrySyncable; |
| 21 class PrefService; |
21 class Profile; | 22 class Profile; |
22 class ThemeService; | 23 class ThemeService; |
23 | 24 |
24 namespace content { | 25 namespace content { |
25 class WebContents; | 26 class WebContents; |
26 } | 27 } |
27 | 28 |
28 namespace gfx { | 29 namespace gfx { |
29 class Rect; | 30 class Rect; |
30 } | 31 } |
31 | 32 |
32 namespace chrome { | 33 namespace chrome { |
33 | 34 |
34 class BrowserInstantController : public content::NotificationObserver, | 35 class BrowserInstantController : public content::NotificationObserver, |
35 public search::SearchModelObserver { | 36 public search::SearchModelObserver { |
36 public: | 37 public: |
37 explicit BrowserInstantController(Browser* browser); | 38 explicit BrowserInstantController(Browser* browser); |
38 virtual ~BrowserInstantController(); | 39 virtual ~BrowserInstantController(); |
39 | 40 |
40 // Returns true if Instant is enabled in a visible, preview-showing mode. | 41 // Returns true if Instant is enabled in a visible, preview-showing mode. |
41 static bool IsInstantEnabled(Profile* profile); | 42 static bool IsInstantEnabled(Profile* profile); |
42 | 43 |
43 // Registers Instant related preferences. | 44 // Registers Instant related preferences. |
44 static void RegisterUserPrefs(PrefServiceSyncable* prefs); | 45 static void RegisterUserPrefs(PrefService* prefs, |
| 46 PrefRegistrySyncable* registry); |
45 | 47 |
46 // If |url| is the new tab page URL, set |target_contents| to the preloaded | 48 // If |url| is the new tab page URL, set |target_contents| to the preloaded |
47 // NTP contents from InstantController. If |source_contents| is not NULL, we | 49 // NTP contents from InstantController. If |source_contents| is not NULL, we |
48 // replace it with the new |target_contents| in the tabstrip and delete | 50 // replace it with the new |target_contents| in the tabstrip and delete |
49 // |source_contents|. Otherwise, the caller owns |target_contents| and is | 51 // |source_contents|. Otherwise, the caller owns |target_contents| and is |
50 // responsible for inserting it into the tabstrip. | 52 // responsible for inserting it into the tabstrip. |
51 // | 53 // |
52 // Returns true if and only if we update |target_contents|. | 54 // Returns true if and only if we update |target_contents|. |
53 bool MaybeSwapInInstantNTPContents( | 55 bool MaybeSwapInInstantNTPContents( |
54 const GURL& url, | 56 const GURL& url, |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 PrefChangeRegistrar profile_pref_registrar_; | 148 PrefChangeRegistrar profile_pref_registrar_; |
147 | 149 |
148 content::NotificationRegistrar registrar_; | 150 content::NotificationRegistrar registrar_; |
149 | 151 |
150 DISALLOW_COPY_AND_ASSIGN(BrowserInstantController); | 152 DISALLOW_COPY_AND_ASSIGN(BrowserInstantController); |
151 }; | 153 }; |
152 | 154 |
153 } // namespace chrome | 155 } // namespace chrome |
154 | 156 |
155 #endif // CHROME_BROWSER_UI_BROWSER_INSTANT_CONTROLLER_H_ | 157 #endif // CHROME_BROWSER_UI_BROWSER_INSTANT_CONTROLLER_H_ |
OLD | NEW |