| 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/message_loop.h" | 10 #include "base/message_loop.h" |
| 11 #include "base/string_util.h" | 11 #include "base/string_util.h" |
| 12 #include "base/time.h" | 12 #include "base/time.h" |
| 13 #include "chrome/browser/browser_process.h" |
| 13 #include "chrome/browser/browser_theme_provider.h" | 14 #include "chrome/browser/browser_theme_provider.h" |
| 14 #include "chrome/browser/profile.h" | 15 #include "chrome/browser/profile.h" |
| 15 #include "chrome/browser/theme_resources_util.h" | 16 #include "chrome/browser/theme_resources_util.h" |
| 16 #include "chrome/common/pref_names.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 |
| (...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 181 subst2.push_back(SkColorToRGBAString(color_section_link)); // $$4 | 182 subst2.push_back(SkColorToRGBAString(color_section_link)); // $$4 |
| 182 subst2.push_back( | 183 subst2.push_back( |
| 183 tp->HasCustomImage(IDR_THEME_NTP_ATTRIBUTION) ? "block" : "none"); // $$5 | 184 tp->HasCustomImage(IDR_THEME_NTP_ATTRIBUTION) ? "block" : "none"); // $$5 |
| 184 subst2.push_back(SkColorToRGBAString(color_link_underline)); // $$6 | 185 subst2.push_back(SkColorToRGBAString(color_link_underline)); // $$6 |
| 185 subst2.push_back(SkColorToRGBAString(color_section_link_underline)); // $$7 | 186 subst2.push_back(SkColorToRGBAString(color_section_link_underline)); // $$7 |
| 186 | 187 |
| 187 #if defined(OS_MACOSX) | 188 #if defined(OS_MACOSX) |
| 188 // No extensions available on Mac yet. | 189 // No extensions available on Mac yet. |
| 189 subst2.push_back("none"); // $$8: display of lower right promo image | 190 subst2.push_back("none"); // $$8: display of lower right promo image |
| 190 #else | 191 #else |
| 191 // Extensions available on both Linux and Windows. | 192 // Extensions available on both Linux and Windows, but for now only in |
| 192 if (profile_->GetPrefs()->GetInteger(prefs::kNTPPromoImageRemaining) > 0) { | 193 // en locales. |
| 194 if ((StartsWithASCII(g_browser_process->GetApplicationLocale(), |
| 195 "en", false)) && // false = compare not case-sensitive. |
| 196 (profile_->GetPrefs()->GetInteger(prefs::kNTPPromoImageRemaining) > 0)) { |
| 193 subst2.push_back("block"); // $$8 | 197 subst2.push_back("block"); // $$8 |
| 194 } else { | 198 } else { |
| 195 subst2.push_back("none"); // $$8 | 199 subst2.push_back("none"); // $$8 |
| 196 } | 200 } |
| 197 #endif | 201 #endif |
| 198 | 202 |
| 199 #if defined(OS_WIN) | 203 #if defined(OS_WIN) |
| 200 // Sync only available on Windows for now. | 204 // Sync only available on Windows for now. |
| 201 if (profile_->GetPrefs()->GetInteger(prefs::kNTPPromoLineRemaining) > 0) { | 205 if (profile_->GetPrefs()->GetInteger(prefs::kNTPPromoLineRemaining) > 0) { |
| 202 subst2.push_back("inline-block"); // $$9: display of footer promo line | 206 subst2.push_back("inline-block"); // $$9: display of footer promo line |
| (...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 307 return BrowserThemeProvider::AlignmentToString(alignment); | 311 return BrowserThemeProvider::AlignmentToString(alignment); |
| 308 } | 312 } |
| 309 | 313 |
| 310 std::string DOMUIThemeSource::GetNewTabBackgroundTilingCSS() { | 314 std::string DOMUIThemeSource::GetNewTabBackgroundTilingCSS() { |
| 311 int repeat_mode; | 315 int repeat_mode; |
| 312 profile_->GetThemeProvider()->GetDisplayProperty( | 316 profile_->GetThemeProvider()->GetDisplayProperty( |
| 313 BrowserThemeProvider::NTP_BACKGROUND_TILING, &repeat_mode); | 317 BrowserThemeProvider::NTP_BACKGROUND_TILING, &repeat_mode); |
| 314 return BrowserThemeProvider::TilingToString(repeat_mode); | 318 return BrowserThemeProvider::TilingToString(repeat_mode); |
| 315 } | 319 } |
| 316 | 320 |
| OLD | NEW |