OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <algorithm> | 7 #include <algorithm> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
426 // to the empty string. | 426 // to the empty string. |
427 localized_strings.SetString("syncNotification", GetSyncTypeMessage()); | 427 localized_strings.SetString("syncNotification", GetSyncTypeMessage()); |
428 } | 428 } |
429 | 429 |
430 // Load the new tab page appropriate for this build | 430 // Load the new tab page appropriate for this build |
431 // Note that some builds (eg. TOUCHUI) don't make use of everything we | 431 // Note that some builds (eg. TOUCHUI) don't make use of everything we |
432 // do here (all of the template data, etc.), but we keep the back end | 432 // do here (all of the template data, etc.), but we keep the back end |
433 // consistent across builds, supporting the union of all NTP front-ends | 433 // consistent across builds, supporting the union of all NTP front-ends |
434 // for simplicity. | 434 // for simplicity. |
435 std::string full_html; | 435 std::string full_html; |
436 if (NewTabUI::Ntp4Enabled()) { | 436 if (NewTabUI::NTP4Enabled()) { |
437 base::StringPiece new_tab_html(ResourceBundle::GetSharedInstance(). | 437 base::StringPiece new_tab_html(ResourceBundle::GetSharedInstance(). |
438 GetRawDataResource(IDR_NEW_TAB_4_HTML)); | 438 GetRawDataResource(IDR_NEW_TAB_4_HTML)); |
439 full_html = jstemplate_builder::GetI18nTemplateHtml(new_tab_html, | 439 full_html = jstemplate_builder::GetI18nTemplateHtml(new_tab_html, |
440 &localized_strings); | 440 &localized_strings); |
441 } else { | 441 } else { |
442 base::StringPiece new_tab_html(ResourceBundle::GetSharedInstance(). | 442 base::StringPiece new_tab_html(ResourceBundle::GetSharedInstance(). |
443 GetRawDataResource(IDR_NEW_TAB_HTML)); | 443 GetRawDataResource(IDR_NEW_TAB_HTML)); |
444 | 444 |
445 // Inject the template data into the HTML so that it is available before any | 445 // Inject the template data into the HTML so that it is available before any |
446 // layout is needed. | 446 // layout is needed. |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
600 color_section_header_text_hover)); // $17 | 600 color_section_header_text_hover)); // $17 |
601 subst.push_back(SkColorToRGBAString(color_section_header_rule)); // $18 | 601 subst.push_back(SkColorToRGBAString(color_section_header_rule)); // $18 |
602 subst.push_back(SkColorToRGBAString( | 602 subst.push_back(SkColorToRGBAString( |
603 color_section_header_rule_light)); // $19 | 603 color_section_header_rule_light)); // $19 |
604 subst.push_back(SkColorToRGBAString( | 604 subst.push_back(SkColorToRGBAString( |
605 SkColorSetA(color_section_header_rule, 0))); // $20 | 605 SkColorSetA(color_section_header_rule, 0))); // $20 |
606 subst.push_back(SkColorToRGBAString(color_text_light)); // $21 | 606 subst.push_back(SkColorToRGBAString(color_text_light)); // $21 |
607 subst.push_back(SkColorToRGBComponents(color_section_border)); // $22 | 607 subst.push_back(SkColorToRGBComponents(color_section_border)); // $22 |
608 | 608 |
609 // Get our template. | 609 // Get our template. |
610 int ntp_css_resource_id = NewTabUI::Ntp4Enabled() ? | 610 int ntp_css_resource_id = NewTabUI::NTP4Enabled() ? |
611 IDR_NEW_TAB_4_THEME_CSS : IDR_NEW_TAB_THEME_CSS; | 611 IDR_NEW_TAB_4_THEME_CSS : IDR_NEW_TAB_THEME_CSS; |
612 static const base::StringPiece new_tab_theme_css( | 612 static const base::StringPiece new_tab_theme_css( |
613 ResourceBundle::GetSharedInstance().GetRawDataResource( | 613 ResourceBundle::GetSharedInstance().GetRawDataResource( |
614 ntp_css_resource_id)); | 614 ntp_css_resource_id)); |
615 | 615 |
616 // Create the string from our template and the replacements. | 616 // Create the string from our template and the replacements. |
617 std::string css_string; | 617 std::string css_string; |
618 css_string = ReplaceStringPlaceholders(new_tab_theme_css, subst, NULL); | 618 css_string = ReplaceStringPlaceholders(new_tab_theme_css, subst, NULL); |
619 new_tab_css_ = base::RefCountedString::TakeString(&css_string); | 619 new_tab_css_ = base::RefCountedString::TakeString(&css_string); |
620 } | 620 } |
OLD | NEW |