Chromium Code Reviews| 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 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 488 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 499 new_tab_html_ = base::RefCountedString::TakeString(&full_html); | 499 new_tab_html_ = base::RefCountedString::TakeString(&full_html); |
| 500 } | 500 } |
| 501 | 501 |
| 502 void NTPResourceCache::CreateNewTabIncognitoCSS() { | 502 void NTPResourceCache::CreateNewTabIncognitoCSS() { |
| 503 // TODO(estade): this returns a subtly incorrect theme provider because | 503 // TODO(estade): this returns a subtly incorrect theme provider because |
| 504 // |profile_| is actually not the incognito profile. See crbug.com/568388 | 504 // |profile_| is actually not the incognito profile. See crbug.com/568388 |
| 505 const ui::ThemeProvider& tp = | 505 const ui::ThemeProvider& tp = |
| 506 ThemeService::GetThemeProviderForProfile(profile_); | 506 ThemeService::GetThemeProviderForProfile(profile_); |
| 507 | 507 |
| 508 // Get our theme colors | 508 // Get our theme colors |
| 509 SkColor color_background = | 509 SkColor color_background = ThemeProperties::GetDefaultColor( |
| 510 tp.HasCustomImage(IDR_THEME_NTP_BACKGROUND) | 510 ThemeProperties::COLOR_NTP_BACKGROUND, |
| 511 ? GetThemeColor(tp, ThemeProperties::COLOR_NTP_BACKGROUND) | 511 !tp.HasCustomImage(IDR_THEME_NTP_BACKGROUND)); |
|
Peter Kasting
2016/08/18 09:12:36
This seems like a behavior change -- before, if th
| |
| 512 : SkColorSetRGB(0x32, 0x32, 0x32); | |
| 513 | 512 |
| 514 // Generate the replacements. | 513 // Generate the replacements. |
| 515 ui::TemplateReplacements substitutions; | 514 ui::TemplateReplacements substitutions; |
| 516 | 515 |
| 517 // Cache-buster for background. | 516 // Cache-buster for background. |
| 518 substitutions["themeId"] = | 517 substitutions["themeId"] = |
| 519 profile_->GetPrefs()->GetString(prefs::kCurrentThemeID); | 518 profile_->GetPrefs()->GetString(prefs::kCurrentThemeID); |
| 520 | 519 |
| 521 // Colors. | 520 // Colors. |
| 522 substitutions["colorBackground"] = SkColorToRGBAString(color_background); | 521 substitutions["colorBackground"] = SkColorToRGBAString(color_background); |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 603 // Get our template. | 602 // Get our template. |
| 604 static const base::StringPiece new_tab_theme_css( | 603 static const base::StringPiece new_tab_theme_css( |
| 605 ResourceBundle::GetSharedInstance().GetRawDataResource( | 604 ResourceBundle::GetSharedInstance().GetRawDataResource( |
| 606 IDR_NEW_TAB_4_THEME_CSS)); | 605 IDR_NEW_TAB_4_THEME_CSS)); |
| 607 | 606 |
| 608 // Create the string from our template and the replacements. | 607 // Create the string from our template and the replacements. |
| 609 std::string css_string = | 608 std::string css_string = |
| 610 ui::ReplaceTemplateExpressions(new_tab_theme_css, substitutions); | 609 ui::ReplaceTemplateExpressions(new_tab_theme_css, substitutions); |
| 611 new_tab_css_ = base::RefCountedString::TakeString(&css_string); | 610 new_tab_css_ = base::RefCountedString::TakeString(&css_string); |
| 612 } | 611 } |
| OLD | NEW |