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 408 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
419 // to the empty string. | 419 // to the empty string. |
420 localized_strings.SetString("syncNotification", GetSyncTypeMessage()); | 420 localized_strings.SetString("syncNotification", GetSyncTypeMessage()); |
421 } | 421 } |
422 | 422 |
423 // Load the new tab page appropriate for this build | 423 // Load the new tab page appropriate for this build |
424 // Note that some builds (eg. TOUCHUI) don't make use of everything we | 424 // Note that some builds (eg. TOUCHUI) don't make use of everything we |
425 // do here (all of the template data, etc.), but we keep the back end | 425 // do here (all of the template data, etc.), but we keep the back end |
426 // consistent across builds, supporting the union of all NTP front-ends | 426 // consistent across builds, supporting the union of all NTP front-ends |
427 // for simplicity. | 427 // for simplicity. |
428 std::string full_html; | 428 std::string full_html; |
429 if (NewTabUI::Ntp4Enabled()) { | 429 if (NewTabUI::NTP4Enabled()) { |
430 base::StringPiece new_tab_html(ResourceBundle::GetSharedInstance(). | 430 base::StringPiece new_tab_html(ResourceBundle::GetSharedInstance(). |
431 GetRawDataResource(IDR_NEW_TAB_4_HTML)); | 431 GetRawDataResource(IDR_NEW_TAB_4_HTML)); |
432 full_html = jstemplate_builder::GetI18nTemplateHtml(new_tab_html, | 432 full_html = jstemplate_builder::GetI18nTemplateHtml(new_tab_html, |
433 &localized_strings); | 433 &localized_strings); |
434 } else { | 434 } else { |
435 base::StringPiece new_tab_html(ResourceBundle::GetSharedInstance(). | 435 base::StringPiece new_tab_html(ResourceBundle::GetSharedInstance(). |
436 GetRawDataResource(IDR_NEW_TAB_HTML)); | 436 GetRawDataResource(IDR_NEW_TAB_HTML)); |
437 | 437 |
438 // Inject the template data into the HTML so that it is available before any | 438 // Inject the template data into the HTML so that it is available before any |
439 // layout is needed. | 439 // layout is needed. |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
593 color_section_header_text_hover)); // $17 | 593 color_section_header_text_hover)); // $17 |
594 subst.push_back(SkColorToRGBAString(color_section_header_rule)); // $18 | 594 subst.push_back(SkColorToRGBAString(color_section_header_rule)); // $18 |
595 subst.push_back(SkColorToRGBAString( | 595 subst.push_back(SkColorToRGBAString( |
596 color_section_header_rule_light)); // $19 | 596 color_section_header_rule_light)); // $19 |
597 subst.push_back(SkColorToRGBAString( | 597 subst.push_back(SkColorToRGBAString( |
598 SkColorSetA(color_section_header_rule, 0))); // $20 | 598 SkColorSetA(color_section_header_rule, 0))); // $20 |
599 subst.push_back(SkColorToRGBAString(color_text_light)); // $21 | 599 subst.push_back(SkColorToRGBAString(color_text_light)); // $21 |
600 subst.push_back(SkColorToRGBComponents(color_section_border)); // $22 | 600 subst.push_back(SkColorToRGBComponents(color_section_border)); // $22 |
601 | 601 |
602 // Get our template. | 602 // Get our template. |
603 int ntp_css_resource_id = NewTabUI::Ntp4Enabled() ? | 603 int ntp_css_resource_id = NewTabUI::NTP4Enabled() ? |
604 IDR_NEW_TAB_4_THEME_CSS : IDR_NEW_TAB_THEME_CSS; | 604 IDR_NEW_TAB_4_THEME_CSS : IDR_NEW_TAB_THEME_CSS; |
605 static const base::StringPiece new_tab_theme_css( | 605 static const base::StringPiece new_tab_theme_css( |
606 ResourceBundle::GetSharedInstance().GetRawDataResource( | 606 ResourceBundle::GetSharedInstance().GetRawDataResource( |
607 ntp_css_resource_id)); | 607 ntp_css_resource_id)); |
608 | 608 |
609 // Create the string from our template and the replacements. | 609 // Create the string from our template and the replacements. |
610 std::string css_string; | 610 std::string css_string; |
611 css_string = ReplaceStringPlaceholders(new_tab_theme_css, subst, NULL); | 611 css_string = ReplaceStringPlaceholders(new_tab_theme_css, subst, NULL); |
612 new_tab_css_ = base::RefCountedString::TakeString(&css_string); | 612 new_tab_css_ = base::RefCountedString::TakeString(&css_string); |
613 } | 613 } |
OLD | NEW |