diff options
author | kuan@chromium.org <kuan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-03-06 20:11:23 +0000 |
---|---|---|
committer | kuan@chromium.org <kuan@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-03-06 20:11:23 +0000 |
commit | 3870363e188f0fbf455278aaa0380882fe3096f1 (patch) | |
tree | a1be4666024f76a41f0d112998d74ba051345676 /chrome/browser | |
parent | 19c64145305eff1938e7a3273bb5187305734577 (diff) | |
download | chromium_src-3870363e188f0fbf455278aaa0380882fe3096f1.zip chromium_src-3870363e188f0fbf455278aaa0380882fe3096f1.tar.gz chromium_src-3870363e188f0fbf455278aaa0380882fe3096f1.tar.bz2 |
alternate ntp: undo theme image top offset for ntp when bookmark bar is unpinned
new look for unpinned bmb doesn't use theme image as background, so NTP should draw the entire theme image from top to bottom
BUG=176280
TEST=verify per bug rpt
Review URL: https://chromiumcodereview.appspot.com/12460009
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@186489 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r-- | chrome/browser/instant/instant_controller.cc | 4 | ||||
-rw-r--r-- | chrome/browser/ui/browser.cc | 5 | ||||
-rw-r--r-- | chrome/browser/ui/browser_instant_controller.cc | 22 | ||||
-rw-r--r-- | chrome/browser/ui/browser_instant_controller.h | 5 |
4 files changed, 11 insertions, 25 deletions
diff --git a/chrome/browser/instant/instant_controller.cc b/chrome/browser/instant/instant_controller.cc index 9d5e396..2be1d0d 100644 --- a/chrome/browser/instant/instant_controller.cc +++ b/chrome/browser/instant/instant_controller.cc @@ -890,7 +890,7 @@ void InstantController::InstantPageRenderViewCreated( return; // Update theme info so that the page picks it up. - browser_->UpdateThemeInfo(false); + browser_->UpdateThemeInfo(); // Ensure the searchbox API has the correct initial state. if (IsContentsFrom(overlay(), contents)) { @@ -1229,7 +1229,7 @@ void InstantController::ResetInstantTab() { instant_tab_.reset(new InstantTab(this)); instant_tab_->Init(active_tab); // Update theme info for this tab. - browser_->UpdateThemeInfo(false); + browser_->UpdateThemeInfo(); instant_tab_->SetDisplayInstantResults(instant_enabled_); instant_tab_->SetOmniboxBounds(omnibox_bounds_); instant_tab_->InitializeFonts(); diff --git a/chrome/browser/ui/browser.cc b/chrome/browser/ui/browser.cc index 7c57e93..332016d 100644 --- a/chrome/browser/ui/browser.cc +++ b/chrome/browser/ui/browser.cc @@ -2146,11 +2146,6 @@ void Browser::UpdateBookmarkBarState(BookmarkBarStateChangeReason reason) { bookmark_bar_state_ = state; - // Inform NTP page of change in bookmark bar state, so that it can adjust the - // theme image top offset if necessary. - if (instant_controller_) - instant_controller_->UpdateThemeInfo(true); - if (!window_) return; // This is called from the constructor when window_ is NULL. diff --git a/chrome/browser/ui/browser_instant_controller.cc b/chrome/browser/ui/browser_instant_controller.cc index 26ebd50..0a32bba 100644 --- a/chrome/browser/ui/browser_instant_controller.cc +++ b/chrome/browser/ui/browser_instant_controller.cc @@ -11,7 +11,6 @@ #include "chrome/browser/themes/theme_properties.h" #include "chrome/browser/themes/theme_service.h" #include "chrome/browser/themes/theme_service_factory.h" -#include "chrome/browser/ui/bookmarks/bookmark_bar_constants.h" #include "chrome/browser/ui/browser.h" #include "chrome/browser/ui/browser_window.h" #include "chrome/browser/ui/omnibox/location_bar.h" @@ -198,10 +197,10 @@ void BrowserInstantController::TabDeactivated(content::WebContents* contents) { instant_.TabDeactivated(contents); } -void BrowserInstantController::UpdateThemeInfo(bool parse_theme_info) { +void BrowserInstantController::UpdateThemeInfo() { // Update theme background info. - // Initialize or re-parse |theme_info| if necessary. - if (!initialized_theme_info_ || parse_theme_info) + // Initialize |theme_info| if necessary. + if (!initialized_theme_info_) OnThemeChanged(ThemeServiceFactory::GetForProfile(profile())); else OnThemeChanged(NULL); @@ -242,7 +241,7 @@ void BrowserInstantController::ModeChanged(const search::Mode& old_mode, const search::Mode& new_mode) { // If mode is now |NTP|, send theme-related information to Instant. if (new_mode.is_ntp()) - UpdateThemeInfo(false); + UpdateThemeInfo(); instant_.SearchModeChanged(old_mode, new_mode); } @@ -292,19 +291,12 @@ void BrowserInstantController::OnThemeChanged(ThemeService* theme_service) { } // Set theme background image vertical alignment. - if (alignment & ThemeProperties::ALIGN_TOP) { + if (alignment & ThemeProperties::ALIGN_TOP) theme_info_.image_vertical_alignment = THEME_BKGRND_IMAGE_ALIGN_TOP; -#if !defined(OS_ANDROID) - // A detached bookmark bar will draw the top part of a top-aligned theme - // image as its background, so offset the image by the bar height. - if (browser_->bookmark_bar_state() == BookmarkBar::DETACHED) - theme_info_.image_top_offset = -chrome::kNTPBookmarkBarHeight; -#endif // !defined(OS_ANDROID) - } else if (alignment & ThemeProperties::ALIGN_BOTTOM) { + else if (alignment & ThemeProperties::ALIGN_BOTTOM) theme_info_.image_vertical_alignment = THEME_BKGRND_IMAGE_ALIGN_BOTTOM; - } else { // ALIGN_CENTER + else // ALIGN_CENTER theme_info_.image_vertical_alignment = THEME_BKGRND_IMAGE_ALIGN_CENTER; - } // Set theme background image tiling. int tiling = 0; diff --git a/chrome/browser/ui/browser_instant_controller.h b/chrome/browser/ui/browser_instant_controller.h index 2924509..e5d6836 100644 --- a/chrome/browser/ui/browser_instant_controller.h +++ b/chrome/browser/ui/browser_instant_controller.h @@ -93,9 +93,8 @@ class BrowserInstantController : public content::NotificationObserver, // Invoked by |browser_| when the active tab is about to be deactivated. void TabDeactivated(content::WebContents* contents); - // Invoked by |instant_| or |browser_| to update theme information for NTP. - // Set |parse_theme_info| to true to force re-parsing of theme information. - void UpdateThemeInfo(bool parse_theme_info); + // Invoked by |instant_| to update theme information for NTP. + void UpdateThemeInfo(); // Invoked by the InstantController when it wants to open a URL. void OpenURL(const GURL& url, |