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

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 scott'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..f672bf19ddcc611c80467c51a94d0707aefda983 100644
--- a/chrome/browser/ui/browser_instant_controller.h
+++ b/chrome/browser/ui/browser_instant_controller.h
@@ -15,6 +15,8 @@
#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;
@@ -26,11 +28,16 @@ namespace gfx {
class Rect;
}
+namespace ui {
+class ThemeProvider;
+};
+
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 +69,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-related information in preview.
+ void UpdateThemeRelatedInfoForPreview();
+
// Overridden from PrefObserver:
virtual void OnPreferenceChanged(PrefServiceBase* service,
const std::string& pref_name) OVERRIDE;
@@ -78,17 +93,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(ui::ThemeProvider* theme_provider);
+
+ // 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.
+ ThemeBackgroundInfo theme_info_;
+ int theme_image_alignment_;
+ 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