OLD | NEW |
1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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" |
11 #include "base/memory/ref_counted_memory.h" | 11 #include "base/memory/ref_counted_memory.h" |
(...skipping 534 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
546 const ui::ThemeProvider& tp = | 546 const ui::ThemeProvider& tp = |
547 ThemeService::GetThemeProviderForProfile(profile_); | 547 ThemeService::GetThemeProviderForProfile(profile_); |
548 | 548 |
549 // Get our theme colors | 549 // Get our theme colors |
550 SkColor color_background = | 550 SkColor color_background = |
551 tp.HasCustomImage(IDR_THEME_NTP_BACKGROUND) | 551 tp.HasCustomImage(IDR_THEME_NTP_BACKGROUND) |
552 ? GetThemeColor(tp, ThemeProperties::COLOR_NTP_BACKGROUND) | 552 ? GetThemeColor(tp, ThemeProperties::COLOR_NTP_BACKGROUND) |
553 : SkColorSetRGB(0x32, 0x32, 0x32); | 553 : SkColorSetRGB(0x32, 0x32, 0x32); |
554 | 554 |
555 // Generate the replacements. | 555 // Generate the replacements. |
556 ui::TemplateReplacements substitutions; | 556 std::map<base::StringPiece, std::string> substitutions; |
557 | 557 |
558 // Cache-buster for background. | 558 // Cache-buster for background. |
559 substitutions["themeId"] = | 559 substitutions["themeId"] = |
560 profile_->GetPrefs()->GetString(prefs::kCurrentThemeID); | 560 profile_->GetPrefs()->GetString(prefs::kCurrentThemeID); |
561 | 561 |
562 // Colors. | 562 // Colors. |
563 substitutions["colorBackground"] = SkColorToRGBAString(color_background); | 563 substitutions["colorBackground"] = SkColorToRGBAString(color_background); |
564 substitutions["backgroundBarDetached"] = GetNewTabBackgroundCSS(tp, false); | 564 substitutions["backgroundBarDetached"] = GetNewTabBackgroundCSS(tp, false); |
565 substitutions["backgroundBarAttached"] = GetNewTabBackgroundCSS(tp, true); | 565 substitutions["backgroundBarAttached"] = GetNewTabBackgroundCSS(tp, true); |
566 substitutions["backgroundTiling"] = GetNewTabBackgroundTilingCSS(tp); | 566 substitutions["backgroundTiling"] = GetNewTabBackgroundTilingCSS(tp); |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
598 // Generate section border color from the header color. See | 598 // Generate section border color from the header color. See |
599 // BookmarkBarView::Paint for how we do this for the bookmark bar | 599 // BookmarkBarView::Paint for how we do this for the bookmark bar |
600 // borders. | 600 // borders. |
601 SkColor color_section_border = | 601 SkColor color_section_border = |
602 SkColorSetARGB(80, | 602 SkColorSetARGB(80, |
603 SkColorGetR(color_header), | 603 SkColorGetR(color_header), |
604 SkColorGetG(color_header), | 604 SkColorGetG(color_header), |
605 SkColorGetB(color_header)); | 605 SkColorGetB(color_header)); |
606 | 606 |
607 // Generate the replacements. | 607 // Generate the replacements. |
608 ui::TemplateReplacements substitutions; | 608 std::map<base::StringPiece, std::string> substitutions; |
609 | 609 |
610 // Cache-buster for background. | 610 // Cache-buster for background. |
611 substitutions["themeId"] = | 611 substitutions["themeId"] = |
612 profile_->GetPrefs()->GetString(prefs::kCurrentThemeID); | 612 profile_->GetPrefs()->GetString(prefs::kCurrentThemeID); |
613 | 613 |
614 // Colors. | 614 // Colors. |
615 substitutions["colorBackground"] = SkColorToRGBAString(color_background); | 615 substitutions["colorBackground"] = SkColorToRGBAString(color_background); |
616 substitutions["backgroundBarDetached"] = GetNewTabBackgroundCSS(tp, false); | 616 substitutions["backgroundBarDetached"] = GetNewTabBackgroundCSS(tp, false); |
617 substitutions["backgroundBarAttached"] = GetNewTabBackgroundCSS(tp, true); | 617 substitutions["backgroundBarAttached"] = GetNewTabBackgroundCSS(tp, true); |
618 substitutions["backgroundTiling"] = GetNewTabBackgroundTilingCSS(tp); | 618 substitutions["backgroundTiling"] = GetNewTabBackgroundTilingCSS(tp); |
(...skipping 25 matching lines...) Expand all Loading... |
644 // Get our template. | 644 // Get our template. |
645 static const base::StringPiece new_tab_theme_css( | 645 static const base::StringPiece new_tab_theme_css( |
646 ResourceBundle::GetSharedInstance().GetRawDataResource( | 646 ResourceBundle::GetSharedInstance().GetRawDataResource( |
647 IDR_NEW_TAB_4_THEME_CSS)); | 647 IDR_NEW_TAB_4_THEME_CSS)); |
648 | 648 |
649 // Create the string from our template and the replacements. | 649 // Create the string from our template and the replacements. |
650 std::string css_string = | 650 std::string css_string = |
651 ui::ReplaceTemplateExpressions(new_tab_theme_css, substitutions); | 651 ui::ReplaceTemplateExpressions(new_tab_theme_css, substitutions); |
652 new_tab_css_ = base::RefCountedString::TakeString(&css_string); | 652 new_tab_css_ = base::RefCountedString::TakeString(&css_string); |
653 } | 653 } |
OLD | NEW |