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

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

Issue 2714633003: Adds more metadata to the about:webapks page (Closed)
Patch Set: Adds more metadata to the about:webapks page Created 3 years, 10 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/webapks/about_webapks.js ('k') | chrome/browser/ui/webui/webapks_handler.cc » ('j') | 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 cbbf9eae016d41c92581fa4c95978e241f61044d..a6ab0c53f09f1ab867d7696471e0fc3676606c53 100644
--- a/chrome/browser/ui/webui/ntp/ntp_resource_cache.cc
+++ b/chrome/browser/ui/webui/ntp/ntp_resource_cache.cc
@@ -90,27 +90,6 @@ const char kLearnMoreGuestSessionUrl[] =
"https://support.google.com/chrome/?p=ui_guest";
#endif
-std::string SkColorToRGBAString(SkColor color) {
- // We convert the alpha using DoubleToString because StringPrintf will use
- // locale specific formatters (e.g., use , instead of . in German).
- return base::StringPrintf(
- "rgba(%d,%d,%d,%s)",
- SkColorGetR(color),
- SkColorGetG(color),
- SkColorGetB(color),
- base::DoubleToString(SkColorGetA(color) / 255.0).c_str());
-}
-
-// Creates an rgb string for an SkColor, but leaves the alpha blank so that the
-// css can fill it in.
-std::string SkColorToRGBComponents(SkColor color) {
- return base::StringPrintf(
- "%d,%d,%d",
- SkColorGetR(color),
- SkColorGetG(color),
- SkColorGetB(color));
-}
-
SkColor GetThemeColor(const ui::ThemeProvider& tp, int id) {
SkColor color = tp.GetColor(id);
// If web contents are being inverted because the system is in high-contrast
@@ -520,7 +499,8 @@ void NTPResourceCache::CreateNewTabIncognitoCSS() {
profile_->GetPrefs()->GetString(prefs::kCurrentThemeID);
// Colors.
- substitutions["colorBackground"] = SkColorToRGBAString(color_background);
+ substitutions["colorBackground"] =
+ color_utils::SkColorToRgbaString(color_background);
substitutions["backgroundBarDetached"] = GetNewTabBackgroundCSS(tp, false);
substitutions["backgroundBarAttached"] = GetNewTabBackgroundCSS(tp, true);
substitutions["backgroundTiling"] = GetNewTabBackgroundTilingCSS(tp);
@@ -572,15 +552,17 @@ void NTPResourceCache::CreateNewTabCSS() {
profile_->GetPrefs()->GetString(prefs::kCurrentThemeID);
// Colors.
- substitutions["colorBackground"] = SkColorToRGBAString(color_background);
+ substitutions["colorBackground"] =
+ color_utils::SkColorToRgbaString(color_background);
substitutions["backgroundBarDetached"] = GetNewTabBackgroundCSS(tp, false);
substitutions["backgroundBarAttached"] = GetNewTabBackgroundCSS(tp, true);
substitutions["backgroundTiling"] = GetNewTabBackgroundTilingCSS(tp);
- substitutions["colorTextRgba"] = SkColorToRGBAString(color_text);
- substitutions["colorTextLight"] = SkColorToRGBAString(color_text_light);
+ substitutions["colorTextRgba"] = color_utils::SkColorToRgbaString(color_text);
+ substitutions["colorTextLight"] =
+ color_utils::SkColorToRgbaString(color_text_light);
substitutions["colorSectionBorder"] =
- SkColorToRGBComponents(color_section_border);
- substitutions["colorText"] = SkColorToRGBComponents(color_text);
+ color_utils::SkColorToRgbString(color_section_border);
+ substitutions["colorText"] = color_utils::SkColorToRgbString(color_text);
// For themes that right-align the background, we flip the attribution to the
// left to avoid conflicts.
« no previous file with comments | « chrome/browser/resources/webapks/about_webapks.js ('k') | chrome/browser/ui/webui/webapks_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698