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 478 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
489 new_tab_html_ = base::RefCountedString::TakeString(&full_html); | 489 new_tab_html_ = base::RefCountedString::TakeString(&full_html); |
490 } | 490 } |
491 | 491 |
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_default = | |
500 base::FeatureList::IsEnabled(features::kMaterialDesignIncognitoNTP) | |
501 ? SkColorSetRGB(0x30, 0x30, 0x30) | |
502 : SkColorSetRGB(0x32, 0x32, 0x32); | |
503 | |
499 SkColor color_background = | 504 SkColor color_background = |
500 tp.HasCustomImage(IDR_THEME_NTP_BACKGROUND) | 505 tp.HasCustomImage(IDR_THEME_NTP_BACKGROUND) |
501 ? GetThemeColor(tp, ThemeProperties::COLOR_NTP_BACKGROUND) | 506 ? GetThemeColor(tp, ThemeProperties::COLOR_NTP_BACKGROUND) |
502 : SkColorSetRGB(0x32, 0x32, 0x32); | 507 : color_background_default; |
Evan Stade
2017/05/24 00:23:43
I'm confused. Can you just remove this ternary and
msramek
2017/05/24 01:05:21
Nope.
If ThemeService routes that to ThemePropert
Evan Stade
2017/05/24 02:00:25
it seems like the new ternary (the feature flag on
msramek
2017/05/24 09:32:18
Done. Thanks for the suggestion, I agree that that
| |
503 | 508 |
504 // Generate the replacements. | 509 // Generate the replacements. |
505 ui::TemplateReplacements substitutions; | 510 ui::TemplateReplacements substitutions; |
506 | 511 |
507 // Cache-buster for background. | 512 // Cache-buster for background. |
508 substitutions["themeId"] = | 513 substitutions["themeId"] = |
509 profile_->GetPrefs()->GetString(prefs::kCurrentThemeID); | 514 profile_->GetPrefs()->GetString(prefs::kCurrentThemeID); |
510 | 515 |
511 // Colors. | 516 // Colors. |
512 substitutions["colorBackground"] = | 517 substitutions["colorBackground"] = |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
594 // Get our template. | 599 // Get our template. |
595 static const base::StringPiece new_tab_theme_css( | 600 static const base::StringPiece new_tab_theme_css( |
596 ResourceBundle::GetSharedInstance().GetRawDataResource( | 601 ResourceBundle::GetSharedInstance().GetRawDataResource( |
597 IDR_NEW_TAB_4_THEME_CSS)); | 602 IDR_NEW_TAB_4_THEME_CSS)); |
598 | 603 |
599 // Create the string from our template and the replacements. | 604 // Create the string from our template and the replacements. |
600 std::string css_string = | 605 std::string css_string = |
601 ui::ReplaceTemplateExpressions(new_tab_theme_css, substitutions); | 606 ui::ReplaceTemplateExpressions(new_tab_theme_css, substitutions); |
602 new_tab_css_ = base::RefCountedString::TakeString(&css_string); | 607 new_tab_css_ = base::RefCountedString::TakeString(&css_string); |
603 } | 608 } |
OLD | NEW |