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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « chrome/browser/resources/ntp4/new_tab_theme.css ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/ui/webui/ntp/ntp_resource_cache.h" 5 #include "chrome/browser/ui/webui/ntp/ntp_resource_cache.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 478 matching lines...) Expand 10 before | Expand all | Expand 10 after
489 489
490 NewTabPageHandler::GetLocalizedValues(profile_, &load_time_data); 490 NewTabPageHandler::GetLocalizedValues(profile_, &load_time_data);
491 AppLauncherLoginHandler::GetLocalizedValues(profile_, &load_time_data); 491 AppLauncherLoginHandler::GetLocalizedValues(profile_, &load_time_data);
492 492
493 webui::SetLoadTimeDataDefaults(app_locale, &load_time_data); 493 webui::SetLoadTimeDataDefaults(app_locale, &load_time_data);
494 494
495 // Control fade and resize animations. 495 // Control fade and resize animations.
496 load_time_data.SetBoolean("anim", 496 load_time_data.SetBoolean("anim",
497 gfx::Animation::ShouldRenderRichAnimation()); 497 gfx::Animation::ShouldRenderRichAnimation());
498 498
499 ui::ThemeProvider* tp = ThemeServiceFactory::GetForProfile(profile_);
500 int alignment = tp->GetDisplayProperty(
501 ThemeProperties::NTP_BACKGROUND_ALIGNMENT);
502 load_time_data.SetString("themegravity",
503 (alignment & ThemeProperties::ALIGN_RIGHT) ? "right" : "");
504
505 // Disable the promo if this is the first run, otherwise set the promo string 499 // Disable the promo if this is the first run, otherwise set the promo string
506 // for display if there is a valid outstanding promo. 500 // for display if there is a valid outstanding promo.
507 if (first_run::IsChromeFirstRun()) { 501 if (first_run::IsChromeFirstRun()) {
508 web_resource::HandleNotificationPromoClosed( 502 web_resource::HandleNotificationPromoClosed(
509 web_resource::NotificationPromo::NTP_NOTIFICATION_PROMO); 503 web_resource::NotificationPromo::NTP_NOTIFICATION_PROMO);
510 } else { 504 } else {
511 web_resource::NotificationPromo notification_promo( 505 web_resource::NotificationPromo notification_promo(
512 g_browser_process->local_state()); 506 g_browser_process->local_state());
513 notification_promo.InitFromPrefs( 507 notification_promo.InitFromPrefs(
514 web_resource::NotificationPromo::NTP_NOTIFICATION_PROMO); 508 web_resource::NotificationPromo::NTP_NOTIFICATION_PROMO);
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after
647 substitutions["backgroundBarAttached"] = GetNewTabBackgroundCSS(tp, true); 641 substitutions["backgroundBarAttached"] = GetNewTabBackgroundCSS(tp, true);
648 substitutions["backgroundTiling"] = GetNewTabBackgroundTilingCSS(tp); 642 substitutions["backgroundTiling"] = GetNewTabBackgroundTilingCSS(tp);
649 substitutions["colorTextRgba"] = SkColorToRGBAString(color_text); 643 substitutions["colorTextRgba"] = SkColorToRGBAString(color_text);
650 substitutions["colorSectionBorder"] = 644 substitutions["colorSectionBorder"] =
651 SkColorToRGBAString(color_section_border); 645 SkColorToRGBAString(color_section_border);
652 substitutions["colorTextLight"] = SkColorToRGBAString(color_text_light); 646 substitutions["colorTextLight"] = SkColorToRGBAString(color_text_light);
653 substitutions["colorSectionBorder"] = 647 substitutions["colorSectionBorder"] =
654 SkColorToRGBComponents(color_section_border); 648 SkColorToRGBComponents(color_section_border);
655 substitutions["colorText"] = SkColorToRGBComponents(color_text); 649 substitutions["colorText"] = SkColorToRGBComponents(color_text);
656 650
651 // For themes that right-align the background, we flip the attribution to the
652 // left to avoid conflicts.
653 int alignment = tp->GetDisplayProperty(
654 ThemeProperties::NTP_BACKGROUND_ALIGNMENT);
655 if (alignment & ThemeProperties::ALIGN_RIGHT) {
656 substitutions["leftAlignAttribution"] = "0";
657 substitutions["rightAlignAttribution"] = "auto";
658 substitutions["textAlignAttribution"] = "right";
659 } else {
660 substitutions["leftAlignAttribution"] = "auto";
661 substitutions["rightAlignAttribution"] = "0";
662 substitutions["textAlignAttribution"] = "left";
663 }
664
657 // Get our template. 665 // Get our template.
658 static const base::StringPiece new_tab_theme_css( 666 static const base::StringPiece new_tab_theme_css(
659 ResourceBundle::GetSharedInstance().GetRawDataResource( 667 ResourceBundle::GetSharedInstance().GetRawDataResource(
660 IDR_NEW_TAB_4_THEME_CSS)); 668 IDR_NEW_TAB_4_THEME_CSS));
661 669
662 // Create the string from our template and the replacements. 670 // Create the string from our template and the replacements.
663 std::string css_string = 671 std::string css_string =
664 ui::ReplaceTemplateExpressions(new_tab_theme_css, substitutions); 672 ui::ReplaceTemplateExpressions(new_tab_theme_css, substitutions);
665 new_tab_css_ = base::RefCountedString::TakeString(&css_string); 673 new_tab_css_ = base::RefCountedString::TakeString(&css_string);
666 } 674 }
OLDNEW
« 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