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

Unified Diff: chrome/browser/ui/browser_instant_controller.h

Issue 11413018: alternate ntp: implement searchbox api for instant overlay to adopt themes (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: addressed sreeram's and chris's comments Created 8 years, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/browser_instant_controller.h
diff --git a/chrome/browser/ui/browser_instant_controller.h b/chrome/browser/ui/browser_instant_controller.h
index 90fe98197b67147da457a8494dfeb41906c3f06d..c6b22715cb51fe8e288c5a51f8fb2dea83c74d9b 100644
--- a/chrome/browser/ui/browser_instant_controller.h
+++ b/chrome/browser/ui/browser_instant_controller.h
@@ -15,12 +15,15 @@
#include "chrome/browser/ui/search/search_model_observer.h"
#include "chrome/browser/ui/tabs/tab_strip_model_observer.h"
#include "chrome/common/instant_types.h"
+#include "content/public/browser/notification_observer.h"
+#include "content/public/browser/notification_registrar.h"
#include "webkit/glue/window_open_disposition.h"
class Browser;
class InstantController;
class InstantTest;
class TabContents;
+class ThemeService;
namespace gfx {
class Rect;
@@ -30,7 +33,8 @@ namespace chrome {
class BrowserInstantController : public TabStripModelObserver,
public search::SearchModelObserver,
- public PrefObserver {
+ public PrefObserver,
+ public content::NotificationObserver {
public:
explicit BrowserInstantController(Browser* browser);
virtual ~BrowserInstantController();
@@ -62,6 +66,14 @@ class BrowserInstantController : public TabStripModelObserver,
// preview would be shown.
TabContents* GetActiveTabContents() const;
+ // Invoked by |BrowserWindow| during layout to set content height which is
+ // used as theme area height, i.e. the height of the area that the entire
+ // theme background image should fill up.
+ void SetContentHeight(int height);
+
+ // Invoked by |instant_| to update theme information for preview.
+ void UpdateThemeInfoForPreview();
+
// Overridden from PrefObserver:
virtual void OnPreferenceChanged(PrefServiceBase* service,
const std::string& pref_name) OVERRIDE;
@@ -78,17 +90,35 @@ class BrowserInstantController : public TabStripModelObserver,
const search::Mode& new_mode) OVERRIDE;
private:
+ // content::NotificationObserver implementation.
+ virtual void Observe(int type,
+ const content::NotificationSource& source,
+ const content::NotificationDetails& details) OVERRIDE;
+
// If this browser should have Instant, a new InstantController created;
// otherwise any existing InstantController is destroyed.
void ResetInstant();
+ // Helper for handling theme change.
+ void OnThemeChanged(ThemeService* theme_service);
+
+ // Helper for handling theme area height change.
+ void OnThemeAreaHeightChanged(int height);
+
Browser* browser_;
scoped_ptr<InstantController> instant_;
InstantUnloadHandler instant_unload_handler_;
+ // Theme-related data for NTP preview to adopt themes.
+ bool initialized_theme_info_; // True if theme_info_ has been initialized.
+ ThemeBackgroundInfo theme_info_;
+ int theme_area_height_;
+
PrefChangeRegistrar profile_pref_registrar_;
+ content::NotificationRegistrar registrar_;
+
DISALLOW_COPY_AND_ASSIGN(BrowserInstantController);
};

Powered by Google App Engine
This is Rietveld 408576698