| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/dom_ui/dom_ui_theme_source.h" | 5 #include "chrome/browser/dom_ui/dom_ui_theme_source.h" |
| 6 | 6 |
| 7 #include "app/l10n_util.h" | 7 #include "app/l10n_util.h" |
| 8 #include "app/resource_bundle.h" | 8 #include "app/resource_bundle.h" |
| 9 #include "app/theme_provider.h" | 9 #include "app/theme_provider.h" |
| 10 #include "base/gfx/png_encoder.h" | 10 #include "base/gfx/png_encoder.h" |
| 11 #include "base/message_loop.h" | 11 #include "base/message_loop.h" |
| 12 #include "base/string_util.h" | 12 #include "base/string_util.h" |
| 13 #include "base/time.h" | 13 #include "base/time.h" |
| 14 #include "chrome/browser/browser_theme_provider.h" | 14 #include "chrome/browser/browser_theme_provider.h" |
| 15 #include "chrome/browser/profile.h" | 15 #include "chrome/browser/profile.h" |
| 16 #include "chrome/browser/theme_resources_util.h" | 16 #include "chrome/browser/theme_resources_util.h" |
| 17 #include "chrome/common/pref_names.h" |
| 17 #include "chrome/common/url_constants.h" | 18 #include "chrome/common/url_constants.h" |
| 18 #include "googleurl/src/gurl.h" | 19 #include "googleurl/src/gurl.h" |
| 19 #include "grit/browser_resources.h" | 20 #include "grit/browser_resources.h" |
| 20 #include "grit/generated_resources.h" | 21 #include "grit/generated_resources.h" |
| 21 #include "grit/theme_resources.h" | 22 #include "grit/theme_resources.h" |
| 22 | 23 |
| 23 #if defined(OS_WIN) | 24 #if defined(OS_WIN) |
| 24 #include "chrome/browser/views/bookmark_bar_view.h" | 25 #include "chrome/browser/views/bookmark_bar_view.h" |
| 25 #endif | 26 #endif |
| 26 | 27 |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 SkColor color_section_lighter = | 108 SkColor color_section_lighter = |
| 108 skia::HSLToSkColor(SkColorGetA(color_section), section_lighter); | 109 skia::HSLToSkColor(SkColorGetA(color_section), section_lighter); |
| 109 | 110 |
| 110 // Generate the replacements. | 111 // Generate the replacements. |
| 111 std::vector<string16> subst; | 112 std::vector<string16> subst; |
| 112 // A second list of replacements, each of which must be in $$x format, | 113 // A second list of replacements, each of which must be in $$x format, |
| 113 // where x is a digit from 1-9. | 114 // where x is a digit from 1-9. |
| 114 std::vector<string16> subst2; | 115 std::vector<string16> subst2; |
| 115 | 116 |
| 116 // Cache-buster for background. | 117 // Cache-buster for background. |
| 117 subst.push_back(UTF8ToUTF16(IntToString(static_cast<int>( | 118 subst.push_back(WideToUTF16( |
| 118 base::Time::Now().ToDoubleT())))); // $1 | 119 profile_->GetPrefs()->GetString(prefs::kCurrentThemeID))); // $1 |
| 119 | 120 |
| 120 // Colors. | 121 // Colors. |
| 121 subst.push_back(SkColorToRGBAString(color_background)); // $2 | 122 subst.push_back(SkColorToRGBAString(color_background)); // $2 |
| 122 subst.push_back(UTF8ToUTF16(GetNewTabBackgroundCSS(false))); // $3 | 123 subst.push_back(UTF8ToUTF16(GetNewTabBackgroundCSS(false))); // $3 |
| 123 subst.push_back(UTF8ToUTF16(GetNewTabBackgroundCSS(true))); // $4 | 124 subst.push_back(UTF8ToUTF16(GetNewTabBackgroundCSS(true))); // $4 |
| 124 subst.push_back(UTF8ToUTF16(GetNewTabBackgroundTilingCSS())); // $5 | 125 subst.push_back(UTF8ToUTF16(GetNewTabBackgroundTilingCSS())); // $5 |
| 125 subst.push_back(SkColorToRGBAString(color_section)); // $6 | 126 subst.push_back(SkColorToRGBAString(color_section)); // $6 |
| 126 subst.push_back(SkColorToRGBAString(color_section_lighter)); // $7 | 127 subst.push_back(SkColorToRGBAString(color_section_lighter)); // $7 |
| 127 subst.push_back(SkColorToRGBAString(color_text)); // $8 | 128 subst.push_back(SkColorToRGBAString(color_text)); // $8 |
| 128 subst.push_back(SkColorToRGBAString(color_link)); // $9 | 129 subst.push_back(SkColorToRGBAString(color_link)); // $9 |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 199 return BrowserThemeProvider::AlignmentToString(alignment); | 200 return BrowserThemeProvider::AlignmentToString(alignment); |
| 200 } | 201 } |
| 201 | 202 |
| 202 std::string DOMUIThemeSource::GetNewTabBackgroundTilingCSS() { | 203 std::string DOMUIThemeSource::GetNewTabBackgroundTilingCSS() { |
| 203 int repeat_mode; | 204 int repeat_mode; |
| 204 profile_->GetThemeProvider()->GetDisplayProperty( | 205 profile_->GetThemeProvider()->GetDisplayProperty( |
| 205 BrowserThemeProvider::NTP_BACKGROUND_TILING, &repeat_mode); | 206 BrowserThemeProvider::NTP_BACKGROUND_TILING, &repeat_mode); |
| 206 return BrowserThemeProvider::TilingToString(repeat_mode); | 207 return BrowserThemeProvider::TilingToString(repeat_mode); |
| 207 } | 208 } |
| 208 | 209 |
| OLD | NEW |