| 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 "base/prefs/public/pref_observer.h" |  | 
|   12 #include "chrome/browser/instant/instant_controller.h" |   11 #include "chrome/browser/instant/instant_controller.h" | 
|   13 #include "chrome/browser/instant/instant_unload_handler.h" |   12 #include "chrome/browser/instant/instant_unload_handler.h" | 
|   14 #include "chrome/browser/ui/search/search_model_observer.h" |   13 #include "chrome/browser/ui/search/search_model_observer.h" | 
|   15 #include "content/public/browser/notification_observer.h" |   14 #include "content/public/browser/notification_observer.h" | 
|   16 #include "content/public/browser/notification_registrar.h" |   15 #include "content/public/browser/notification_registrar.h" | 
|   17 #include "webkit/glue/window_open_disposition.h" |   16 #include "webkit/glue/window_open_disposition.h" | 
|   18  |   17  | 
|   19 class Browser; |   18 class Browser; | 
|   20 struct InstantSuggestion; |   19 struct InstantSuggestion; | 
|   21 class PrefService; |   20 class PrefService; | 
|   22 class Profile; |   21 class Profile; | 
|   23 class TabContents; |   22 class TabContents; | 
|   24 class ThemeService; |   23 class ThemeService; | 
|   25  |   24  | 
|   26 namespace gfx { |   25 namespace gfx { | 
|   27 class Rect; |   26 class Rect; | 
|   28 } |   27 } | 
|   29  |   28  | 
|   30 namespace chrome { |   29 namespace chrome { | 
|   31  |   30  | 
|   32 class BrowserInstantController : public PrefObserver, |   31 class BrowserInstantController : public content::NotificationObserver, | 
|   33                                  public content::NotificationObserver, |  | 
|   34                                  public search::SearchModelObserver { |   32                                  public search::SearchModelObserver { | 
|   35  public: |   33  public: | 
|   36   explicit BrowserInstantController(Browser* browser); |   34   explicit BrowserInstantController(Browser* browser); | 
|   37   virtual ~BrowserInstantController(); |   35   virtual ~BrowserInstantController(); | 
|   38  |   36  | 
|   39   // Returns true if Instant is enabled in a visible, preview-showing mode. |   37   // Returns true if Instant is enabled in a visible, preview-showing mode. | 
|   40   static bool IsInstantEnabled(Profile* profile); |   38   static bool IsInstantEnabled(Profile* profile); | 
|   41  |   39  | 
|   42   // Registers Instant related preferences. |   40   // Registers Instant related preferences. | 
|   43   static void RegisterUserPrefs(PrefService* prefs); |   41   static void RegisterUserPrefs(PrefService* prefs); | 
| (...skipping 30 matching lines...) Expand all  Loading... | 
|   74  |   72  | 
|   75   // Invoked by |BrowserWindow| during layout to set content height which is |   73   // Invoked by |BrowserWindow| during layout to set content height which is | 
|   76   // used as theme area height, i.e. the height of the area that the entire |   74   // used as theme area height, i.e. the height of the area that the entire | 
|   77   // theme background image should fill up. |   75   // theme background image should fill up. | 
|   78   void SetContentHeight(int height); |   76   void SetContentHeight(int height); | 
|   79  |   77  | 
|   80   // Invoked by |instant_| to update theme information for preview. |   78   // Invoked by |instant_| to update theme information for preview. | 
|   81   void UpdateThemeInfoForPreview(); |   79   void UpdateThemeInfoForPreview(); | 
|   82  |   80  | 
|   83  private: |   81  private: | 
|   84   // Overridden from PrefObserver: |   82   // Sets the value of |instant_| based on value from profile. Invoked | 
|   85   virtual void OnPreferenceChanged(PrefServiceBase* service, |   83   // on pref change. | 
|   86                                    const std::string& pref_name) OVERRIDE; |   84   void ResetInstant(); | 
|   87  |   85  | 
|   88   // Overridden from search::SearchModelObserver: |   86   // Overridden from search::SearchModelObserver: | 
|   89   virtual void ModeChanged(const search::Mode& old_mode, |   87   virtual void ModeChanged(const search::Mode& old_mode, | 
|   90                            const search::Mode& new_mode) OVERRIDE; |   88                            const search::Mode& new_mode) OVERRIDE; | 
|   91  |   89  | 
|   92   // content::NotificationObserver implementation. |   90   // content::NotificationObserver implementation. | 
|   93   virtual void Observe(int type, |   91   virtual void Observe(int type, | 
|   94                        const content::NotificationSource& source, |   92                        const content::NotificationSource& source, | 
|   95                        const content::NotificationDetails& details) OVERRIDE; |   93                        const content::NotificationDetails& details) OVERRIDE; | 
|   96  |   94  | 
| (...skipping 16 matching lines...) Expand all  Loading... | 
|  113   PrefChangeRegistrar profile_pref_registrar_; |  111   PrefChangeRegistrar profile_pref_registrar_; | 
|  114  |  112  | 
|  115   content::NotificationRegistrar registrar_; |  113   content::NotificationRegistrar registrar_; | 
|  116  |  114  | 
|  117   DISALLOW_COPY_AND_ASSIGN(BrowserInstantController); |  115   DISALLOW_COPY_AND_ASSIGN(BrowserInstantController); | 
|  118 }; |  116 }; | 
|  119  |  117  | 
|  120 }  // namespace chrome |  118 }  // namespace chrome | 
|  121  |  119  | 
|  122 #endif  // CHROME_BROWSER_UI_BROWSER_INSTANT_CONTROLLER_H_ |  120 #endif  // CHROME_BROWSER_UI_BROWSER_INSTANT_CONTROLLER_H_ | 
| OLD | NEW |