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 | 8 |
9 #include "base/feature_list.h" | 9 #include "base/feature_list.h" |
10 #include "base/memory/ref_counted_memory.h" | 10 #include "base/memory/ref_counted_memory.h" |
(...skipping 481 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
492 void NTPResourceCache::CreateNewTabIncognitoCSS() { | 492 void NTPResourceCache::CreateNewTabIncognitoCSS() { |
493 // TODO(estade): this returns a subtly incorrect theme provider because | 493 // TODO(estade): this returns a subtly incorrect theme provider because |
494 // |profile_| is actually not the incognito profile. See crbug.com/568388 | 494 // |profile_| is actually not the incognito profile. See crbug.com/568388 |
495 const ui::ThemeProvider& tp = | 495 const ui::ThemeProvider& tp = |
496 ThemeService::GetThemeProviderForProfile(profile_); | 496 ThemeService::GetThemeProviderForProfile(profile_); |
497 | 497 |
498 // Get our theme colors | 498 // Get our theme colors |
499 SkColor color_background = | 499 SkColor color_background = |
500 tp.HasCustomImage(IDR_THEME_NTP_BACKGROUND) | 500 tp.HasCustomImage(IDR_THEME_NTP_BACKGROUND) |
501 ? GetThemeColor(tp, ThemeProperties::COLOR_NTP_BACKGROUND) | 501 ? GetThemeColor(tp, ThemeProperties::COLOR_NTP_BACKGROUND) |
502 : SkColorSetRGB(0x32, 0x32, 0x32); | 502 : ThemeProperties::GetDefaultColor( |
| 503 ThemeProperties::COLOR_NTP_BACKGROUND, true /* incognito */); |
503 | 504 |
504 // Generate the replacements. | 505 // Generate the replacements. |
505 ui::TemplateReplacements substitutions; | 506 ui::TemplateReplacements substitutions; |
506 | 507 |
507 // Cache-buster for background. | 508 // Cache-buster for background. |
508 substitutions["themeId"] = | 509 substitutions["themeId"] = |
509 profile_->GetPrefs()->GetString(prefs::kCurrentThemeID); | 510 profile_->GetPrefs()->GetString(prefs::kCurrentThemeID); |
510 | 511 |
511 // Colors. | 512 // Colors. |
512 substitutions["colorBackground"] = | 513 substitutions["colorBackground"] = |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
594 // Get our template. | 595 // Get our template. |
595 static const base::StringPiece new_tab_theme_css( | 596 static const base::StringPiece new_tab_theme_css( |
596 ResourceBundle::GetSharedInstance().GetRawDataResource( | 597 ResourceBundle::GetSharedInstance().GetRawDataResource( |
597 IDR_NEW_TAB_4_THEME_CSS)); | 598 IDR_NEW_TAB_4_THEME_CSS)); |
598 | 599 |
599 // Create the string from our template and the replacements. | 600 // Create the string from our template and the replacements. |
600 std::string css_string = | 601 std::string css_string = |
601 ui::ReplaceTemplateExpressions(new_tab_theme_css, substitutions); | 602 ui::ReplaceTemplateExpressions(new_tab_theme_css, substitutions); |
602 new_tab_css_ = base::RefCountedString::TakeString(&css_string); | 603 new_tab_css_ = base::RefCountedString::TakeString(&css_string); |
603 } | 604 } |
OLD | NEW |