| OLD | NEW |
| 1 // Copyright (c) 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" |
| (...skipping 545 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 556 subst.push_back(GetNewTabBackgroundCSS(tp, false)); // $3 | 556 subst.push_back(GetNewTabBackgroundCSS(tp, false)); // $3 |
| 557 subst.push_back(GetNewTabBackgroundCSS(tp, true)); // $4 | 557 subst.push_back(GetNewTabBackgroundCSS(tp, true)); // $4 |
| 558 subst.push_back(GetNewTabBackgroundTilingCSS(tp)); // $5 | 558 subst.push_back(GetNewTabBackgroundTilingCSS(tp)); // $5 |
| 559 | 559 |
| 560 // Get our template. | 560 // Get our template. |
| 561 static const base::StringPiece new_tab_theme_css( | 561 static const base::StringPiece new_tab_theme_css( |
| 562 ResourceBundle::GetSharedInstance().GetRawDataResource( | 562 ResourceBundle::GetSharedInstance().GetRawDataResource( |
| 563 IDR_NEW_INCOGNITO_TAB_THEME_CSS)); | 563 IDR_NEW_INCOGNITO_TAB_THEME_CSS)); |
| 564 | 564 |
| 565 // Create the string from our template and the replacements. | 565 // Create the string from our template and the replacements. |
| 566 std::string full_css = ReplaceStringPlaceholders( | 566 std::string full_css = base::ReplaceStringPlaceholders( |
| 567 new_tab_theme_css, subst, NULL); | 567 new_tab_theme_css, subst, NULL); |
| 568 | 568 |
| 569 new_tab_incognito_css_ = base::RefCountedString::TakeString(&full_css); | 569 new_tab_incognito_css_ = base::RefCountedString::TakeString(&full_css); |
| 570 } | 570 } |
| 571 | 571 |
| 572 void NTPResourceCache::CreateNewTabGuestCSS() { | 572 void NTPResourceCache::CreateNewTabGuestCSS() { |
| 573 ui::ThemeProvider* tp = ThemeServiceFactory::GetForProfile(profile_); | 573 ui::ThemeProvider* tp = ThemeServiceFactory::GetForProfile(profile_); |
| 574 DCHECK(tp); | 574 DCHECK(tp); |
| 575 | 575 |
| 576 // Get our theme colors | 576 // Get our theme colors |
| (...skipping 12 matching lines...) Expand all Loading... |
| 589 subst.push_back(GetNewTabBackgroundCSS(tp, false)); // $3 | 589 subst.push_back(GetNewTabBackgroundCSS(tp, false)); // $3 |
| 590 subst.push_back(GetNewTabBackgroundCSS(tp, true)); // $4 | 590 subst.push_back(GetNewTabBackgroundCSS(tp, true)); // $4 |
| 591 subst.push_back(GetNewTabBackgroundTilingCSS(tp)); // $5 | 591 subst.push_back(GetNewTabBackgroundTilingCSS(tp)); // $5 |
| 592 | 592 |
| 593 // Get our template. | 593 // Get our template. |
| 594 static const base::StringPiece new_tab_theme_css( | 594 static const base::StringPiece new_tab_theme_css( |
| 595 ResourceBundle::GetSharedInstance().GetRawDataResource( | 595 ResourceBundle::GetSharedInstance().GetRawDataResource( |
| 596 IDR_NEW_INCOGNITO_TAB_THEME_CSS)); | 596 IDR_NEW_INCOGNITO_TAB_THEME_CSS)); |
| 597 | 597 |
| 598 // Create the string from our template and the replacements. | 598 // Create the string from our template and the replacements. |
| 599 std::string full_css = ReplaceStringPlaceholders( | 599 std::string full_css = base::ReplaceStringPlaceholders( |
| 600 new_tab_theme_css, subst, NULL); | 600 new_tab_theme_css, subst, NULL); |
| 601 | 601 |
| 602 new_tab_guest_css_ = base::RefCountedString::TakeString(&full_css); | 602 new_tab_guest_css_ = base::RefCountedString::TakeString(&full_css); |
| 603 } | 603 } |
| 604 | 604 |
| 605 void NTPResourceCache::CreateNewTabCSS() { | 605 void NTPResourceCache::CreateNewTabCSS() { |
| 606 ui::ThemeProvider* tp = ThemeServiceFactory::GetForProfile(profile_); | 606 ui::ThemeProvider* tp = ThemeServiceFactory::GetForProfile(profile_); |
| 607 DCHECK(tp); | 607 DCHECK(tp); |
| 608 | 608 |
| 609 // Get our theme colors | 609 // Get our theme colors |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 685 subst.push_back(SkColorToRGBComponents(color_section_border)); // $22 | 685 subst.push_back(SkColorToRGBComponents(color_section_border)); // $22 |
| 686 subst.push_back(SkColorToRGBComponents(color_text)); // $23 | 686 subst.push_back(SkColorToRGBComponents(color_text)); // $23 |
| 687 | 687 |
| 688 // Get our template. | 688 // Get our template. |
| 689 static const base::StringPiece new_tab_theme_css( | 689 static const base::StringPiece new_tab_theme_css( |
| 690 ResourceBundle::GetSharedInstance().GetRawDataResource( | 690 ResourceBundle::GetSharedInstance().GetRawDataResource( |
| 691 IDR_NEW_TAB_4_THEME_CSS)); | 691 IDR_NEW_TAB_4_THEME_CSS)); |
| 692 | 692 |
| 693 // Create the string from our template and the replacements. | 693 // Create the string from our template and the replacements. |
| 694 std::string css_string; | 694 std::string css_string; |
| 695 css_string = ReplaceStringPlaceholders(new_tab_theme_css, subst, NULL); | 695 css_string = base::ReplaceStringPlaceholders(new_tab_theme_css, subst, NULL); |
| 696 new_tab_css_ = base::RefCountedString::TakeString(&css_string); | 696 new_tab_css_ = base::RefCountedString::TakeString(&css_string); |
| 697 } | 697 } |
| OLD | NEW |