Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 561 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 572 | 572 |
| 573 // Colors. | 573 // Colors. |
| 574 substitutions["colorBackground"] = SkColorToRGBAString(color_background); | 574 substitutions["colorBackground"] = SkColorToRGBAString(color_background); |
| 575 substitutions["backgroundBarDetached"] = GetNewTabBackgroundCSS(tp, false); | 575 substitutions["backgroundBarDetached"] = GetNewTabBackgroundCSS(tp, false); |
| 576 substitutions["backgroundBarAttached"] = GetNewTabBackgroundCSS(tp, true); | 576 substitutions["backgroundBarAttached"] = GetNewTabBackgroundCSS(tp, true); |
| 577 substitutions["backgroundTiling"] = GetNewTabBackgroundTilingCSS(tp); | 577 substitutions["backgroundTiling"] = GetNewTabBackgroundTilingCSS(tp); |
| 578 substitutions["colorTextRgba"] = SkColorToRGBAString(color_text); | 578 substitutions["colorTextRgba"] = SkColorToRGBAString(color_text); |
| 579 substitutions["colorSectionBorder"] = | 579 substitutions["colorSectionBorder"] = |
| 580 SkColorToRGBAString(color_section_border); | 580 SkColorToRGBAString(color_section_border); |
| 581 substitutions["colorTextLight"] = SkColorToRGBAString(color_text_light); | 581 substitutions["colorTextLight"] = SkColorToRGBAString(color_text_light); |
| 582 substitutions["colorSectionBorder"] = | |
| 583 SkColorToRGBComponents(color_section_border); | |
|
Peter Kasting
2016/10/27 22:29:10
The first addition was as a string, this one as co
hans
2016/10/27 22:44:38
Hmm, you're right. I was assuming an RGBA string a
dschuyler
2016/10/27 23:07:34
I think that I didn't notice that there were two
p
hans
2016/10/27 23:13:07
Sounds good to me. New patch uploaded.
| |
| 584 substitutions["colorText"] = SkColorToRGBComponents(color_text); | 582 substitutions["colorText"] = SkColorToRGBComponents(color_text); |
| 585 | 583 |
| 586 // For themes that right-align the background, we flip the attribution to the | 584 // For themes that right-align the background, we flip the attribution to the |
| 587 // left to avoid conflicts. | 585 // left to avoid conflicts. |
| 588 int alignment = | 586 int alignment = |
| 589 tp.GetDisplayProperty(ThemeProperties::NTP_BACKGROUND_ALIGNMENT); | 587 tp.GetDisplayProperty(ThemeProperties::NTP_BACKGROUND_ALIGNMENT); |
| 590 if (alignment & ThemeProperties::ALIGN_RIGHT) { | 588 if (alignment & ThemeProperties::ALIGN_RIGHT) { |
| 591 substitutions["leftAlignAttribution"] = "0"; | 589 substitutions["leftAlignAttribution"] = "0"; |
| 592 substitutions["rightAlignAttribution"] = "auto"; | 590 substitutions["rightAlignAttribution"] = "auto"; |
| 593 substitutions["textAlignAttribution"] = "right"; | 591 substitutions["textAlignAttribution"] = "right"; |
| 594 } else { | 592 } else { |
| 595 substitutions["leftAlignAttribution"] = "auto"; | 593 substitutions["leftAlignAttribution"] = "auto"; |
| 596 substitutions["rightAlignAttribution"] = "0"; | 594 substitutions["rightAlignAttribution"] = "0"; |
| 597 substitutions["textAlignAttribution"] = "left"; | 595 substitutions["textAlignAttribution"] = "left"; |
| 598 } | 596 } |
| 599 | 597 |
| 600 substitutions["displayAttribution"] = | 598 substitutions["displayAttribution"] = |
| 601 tp.HasCustomImage(IDR_THEME_NTP_ATTRIBUTION) ? "inline" : "none"; | 599 tp.HasCustomImage(IDR_THEME_NTP_ATTRIBUTION) ? "inline" : "none"; |
| 602 | 600 |
| 603 // Get our template. | 601 // Get our template. |
| 604 static const base::StringPiece new_tab_theme_css( | 602 static const base::StringPiece new_tab_theme_css( |
| 605 ResourceBundle::GetSharedInstance().GetRawDataResource( | 603 ResourceBundle::GetSharedInstance().GetRawDataResource( |
| 606 IDR_NEW_TAB_4_THEME_CSS)); | 604 IDR_NEW_TAB_4_THEME_CSS)); |
| 607 | 605 |
| 608 // Create the string from our template and the replacements. | 606 // Create the string from our template and the replacements. |
| 609 std::string css_string = | 607 std::string css_string = |
| 610 ui::ReplaceTemplateExpressions(new_tab_theme_css, substitutions); | 608 ui::ReplaceTemplateExpressions(new_tab_theme_css, substitutions); |
| 611 new_tab_css_ = base::RefCountedString::TakeString(&css_string); | 609 new_tab_css_ = base::RefCountedString::TakeString(&css_string); |
| 612 } | 610 } |
| OLD | NEW |