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

Unified Diff: chrome/browser/ui/webui/ntp/ntp_resource_cache.cc

Issue 11365075: alternate ntp: tweaks and fixes for bookmark bar in ntp (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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
« no previous file with comments | « chrome/browser/ui/views/frame/browser_view_layout.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/webui/ntp/ntp_resource_cache.cc
diff --git a/chrome/browser/ui/webui/ntp/ntp_resource_cache.cc b/chrome/browser/ui/webui/ntp/ntp_resource_cache.cc
index 73e81d4a2989dd50f8f4d690a43b18c168eb5e0e..5b2a045b7fdcb0b88fc1a3af6ec98ca57df1ce15 100644
--- a/chrome/browser/ui/webui/ntp/ntp_resource_cache.cc
+++ b/chrome/browser/ui/webui/ntp/ntp_resource_cache.cc
@@ -118,7 +118,8 @@ SkColor GetThemeColor(ui::ThemeProvider* tp, int id) {
// Get the CSS string for the background position on the new tab page for the
// states when the bar is attached or detached.
std::string GetNewTabBackgroundCSS(const ui::ThemeProvider* theme_provider,
- bool bar_attached) {
+ bool bar_attached,
+ bool is_ntp_search) {
int alignment;
theme_provider->GetDisplayProperty(
ThemeService::NTP_BACKGROUND_ALIGNMENT, &alignment);
@@ -131,7 +132,12 @@ std::string GetNewTabBackgroundCSS(const ui::ThemeProvider* theme_provider,
return "-64px";
}
- if (bar_attached)
+ // For instant extended API i.e. |is_ntp_search| is true, bookmark bar is
+ // always detached at bottom of content view in the y-direction, floating on
+ // top of it in the z-order, and not showing any part of the theme background
+ // image, so the content view should show the entire theme background image as
+ // is, with no vertical offset.
+ if (bar_attached || is_ntp_search)
return ThemeService::AlignmentToString(alignment);
if (alignment & ThemeService::ALIGN_TOP) {
@@ -455,10 +461,12 @@ void NTPResourceCache::CreateNewTabIncognitoCSS() {
subst.push_back(
profile_->GetPrefs()->GetString(prefs::kCurrentThemeID)); // $1
+ bool is_ntp_search = chrome::search::IsInstantExtendedAPIEnabled(profile_);
+
// Colors.
subst.push_back(SkColorToRGBAString(color_background)); // $2
- subst.push_back(GetNewTabBackgroundCSS(tp, false)); // $3
- subst.push_back(GetNewTabBackgroundCSS(tp, true)); // $4
+ subst.push_back(GetNewTabBackgroundCSS(tp, false, is_ntp_search)); // $3
+ subst.push_back(GetNewTabBackgroundCSS(tp, true, is_ntp_search)); // $4
subst.push_back(GetNewTabBackgroundTilingCSS(tp)); // $5
// Get our template.
@@ -529,10 +537,12 @@ void NTPResourceCache::CreateNewTabCSS() {
subst.push_back(
profile_->GetPrefs()->GetString(prefs::kCurrentThemeID)); // $1
+ bool is_ntp_search = chrome::search::IsInstantExtendedAPIEnabled(profile_);
+
// Colors.
subst.push_back(SkColorToRGBAString(color_background)); // $2
- subst.push_back(GetNewTabBackgroundCSS(tp, false)); // $3
- subst.push_back(GetNewTabBackgroundCSS(tp, true)); // $4
+ subst.push_back(GetNewTabBackgroundCSS(tp, false, is_ntp_search)); // $3
+ subst.push_back(GetNewTabBackgroundCSS(tp, true, is_ntp_search)); // $4
subst.push_back(GetNewTabBackgroundTilingCSS(tp)); // $5
subst.push_back(SkColorToRGBAString(color_header)); // $6
subst.push_back(SkColorToRGBAString(color_header_gradient_light)); // $7
@@ -558,8 +568,7 @@ void NTPResourceCache::CreateNewTabCSS() {
// Get our template.
static const base::StringPiece new_tab_theme_css(
- ResourceBundle::GetSharedInstance().GetRawDataResource(
- chrome::search::IsInstantExtendedAPIEnabled(profile_) ?
+ ResourceBundle::GetSharedInstance().GetRawDataResource(is_ntp_search ?
IDR_NEW_TAB_SEARCH_THEME_CSS : IDR_NEW_TAB_4_THEME_CSS));
// Create the string from our template and the replacements.
« no previous file with comments | « chrome/browser/ui/views/frame/browser_view_layout.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698