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

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

Issue 1312163007: Update the alignment of the chrome://apps theme attribution when theme is installed (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@theme_handler_crash
Patch Set: Created 5 years, 3 months 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/resources/ntp4/new_tab_theme.css ('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 4a23e970ec4238782295f8cfbfd6fc2072cfc0ac..5cc7c95cd73758efbbb2bc06fde3f77faca5abbd 100644
--- a/chrome/browser/ui/webui/ntp/ntp_resource_cache.cc
+++ b/chrome/browser/ui/webui/ntp/ntp_resource_cache.cc
@@ -496,12 +496,6 @@ void NTPResourceCache::CreateNewTabHTML() {
load_time_data.SetBoolean("anim",
gfx::Animation::ShouldRenderRichAnimation());
- ui::ThemeProvider* tp = ThemeServiceFactory::GetForProfile(profile_);
- int alignment = tp->GetDisplayProperty(
- ThemeProperties::NTP_BACKGROUND_ALIGNMENT);
- load_time_data.SetString("themegravity",
- (alignment & ThemeProperties::ALIGN_RIGHT) ? "right" : "");
-
// Disable the promo if this is the first run, otherwise set the promo string
// for display if there is a valid outstanding promo.
if (first_run::IsChromeFirstRun()) {
@@ -654,6 +648,20 @@ void NTPResourceCache::CreateNewTabCSS() {
SkColorToRGBComponents(color_section_border);
substitutions["colorText"] = SkColorToRGBComponents(color_text);
+ // For themes that right-align the background, we flip the attribution to the
+ // left to avoid conflicts.
+ int alignment = tp->GetDisplayProperty(
+ ThemeProperties::NTP_BACKGROUND_ALIGNMENT);
+ if (alignment & ThemeProperties::ALIGN_RIGHT) {
+ substitutions["leftAlignAttribution"] = "0";
+ substitutions["rightAlignAttribution"] = "auto";
+ substitutions["textAlignAttribution"] = "right";
+ } else {
+ substitutions["leftAlignAttribution"] = "auto";
+ substitutions["rightAlignAttribution"] = "0";
+ substitutions["textAlignAttribution"] = "left";
+ }
+
// Get our template.
static const base::StringPiece new_tab_theme_css(
ResourceBundle::GetSharedInstance().GetRawDataResource(
« no previous file with comments | « chrome/browser/resources/ntp4/new_tab_theme.css ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698