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" |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 subst2.push_back(SkColorToRGBAString(color_section)); // $$1 | 173 subst2.push_back(SkColorToRGBAString(color_section)); // $$1 |
174 subst2.push_back(SkColorToRGBAString(color_section_border)); // $$2 | 174 subst2.push_back(SkColorToRGBAString(color_section_border)); // $$2 |
175 subst2.push_back(SkColorToRGBAString(color_section_text)); // $$3 | 175 subst2.push_back(SkColorToRGBAString(color_section_text)); // $$3 |
176 subst2.push_back(SkColorToRGBAString(color_section_link)); // $$4 | 176 subst2.push_back(SkColorToRGBAString(color_section_link)); // $$4 |
177 subst2.push_back( | 177 subst2.push_back( |
178 UTF8ToUTF16(tp->HasCustomImage(IDR_THEME_NTP_ATTRIBUTION) ? | 178 UTF8ToUTF16(tp->HasCustomImage(IDR_THEME_NTP_ATTRIBUTION) ? |
179 "block" : "none")); // $$5 | 179 "block" : "none")); // $$5 |
180 subst2.push_back(SkColorToRGBAString(color_link_underline)); // $$6 | 180 subst2.push_back(SkColorToRGBAString(color_link_underline)); // $$6 |
181 subst2.push_back(SkColorToRGBAString(color_section_link_underline)); // $$7 | 181 subst2.push_back(SkColorToRGBAString(color_section_link_underline)); // $$7 |
182 | 182 |
| 183 if (profile_->GetPrefs()->GetInteger(prefs::kNTPThemePromoRemaining) > 0) |
| 184 subst2.push_back(UTF8ToUTF16("block")); // $$8 |
| 185 else |
| 186 subst2.push_back(UTF8ToUTF16("none")); // $$8 |
| 187 |
183 // Get our template. | 188 // Get our template. |
184 static const base::StringPiece new_tab_theme_css( | 189 static const base::StringPiece new_tab_theme_css( |
185 ResourceBundle::GetSharedInstance().GetRawDataResource( | 190 ResourceBundle::GetSharedInstance().GetRawDataResource( |
186 IDR_NEW_TAB_THEME_CSS)); | 191 IDR_NEW_TAB_THEME_CSS)); |
187 | 192 |
188 // Create the string from our template and the replacements. | 193 // Create the string from our template and the replacements. |
189 string16 format_string = ASCIIToUTF16(new_tab_theme_css.as_string()); | 194 string16 format_string = ASCIIToUTF16(new_tab_theme_css.as_string()); |
190 const std::string css_string = UTF16ToASCII(ReplaceStringPlaceholders( | 195 const std::string css_string = UTF16ToASCII(ReplaceStringPlaceholders( |
191 format_string, subst, NULL)); | 196 format_string, subst, NULL)); |
192 new_tab_css_ = UTF16ToASCII(ReplaceStringPlaceholders( | 197 new_tab_css_ = UTF16ToASCII(ReplaceStringPlaceholders( |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
284 return BrowserThemeProvider::AlignmentToString(alignment); | 289 return BrowserThemeProvider::AlignmentToString(alignment); |
285 } | 290 } |
286 | 291 |
287 std::string DOMUIThemeSource::GetNewTabBackgroundTilingCSS() { | 292 std::string DOMUIThemeSource::GetNewTabBackgroundTilingCSS() { |
288 int repeat_mode; | 293 int repeat_mode; |
289 profile_->GetThemeProvider()->GetDisplayProperty( | 294 profile_->GetThemeProvider()->GetDisplayProperty( |
290 BrowserThemeProvider::NTP_BACKGROUND_TILING, &repeat_mode); | 295 BrowserThemeProvider::NTP_BACKGROUND_TILING, &repeat_mode); |
291 return BrowserThemeProvider::TilingToString(repeat_mode); | 296 return BrowserThemeProvider::TilingToString(repeat_mode); |
292 } | 297 } |
293 | 298 |
OLD | NEW |