Chromium Code Reviews| Index: chrome/browser/ui/webui/ntp/ntp_resource_cache.cc |
| diff --git a/chrome/browser/ui/webui/ntp/ntp_resource_cache.cc b/chrome/browser/ui/webui/ntp/ntp_resource_cache.cc |
| index 8d54d8bc9df005d3b4284ab7ef161ec9f89bbcde..1e31b137d047614ceb1c26c23fe688227fa0a652 100644 |
| --- a/chrome/browser/ui/webui/ntp/ntp_resource_cache.cc |
| +++ b/chrome/browser/ui/webui/ntp/ntp_resource_cache.cc |
| @@ -423,41 +423,37 @@ void NTPResourceCache::CreateNewTabHTML() { |
| UserMetrics::RecordAction(UserMetricsAction("NTPPromoShown")); |
| } |
| - // Load the new tab page appropriate for this build |
| - // Note that some builds (eg. TOUCHUI) don't make use of everything we |
| - // do here (all of the template data, etc.), but we keep the back end |
| - // consistent across builds, supporting the union of all NTP front-ends |
| - // for simplicity. |
| + // Load the new tab page appropriate for this build. |
| std::string full_html; |
| - if (NewTabUI::NTP4Enabled()) { |
| - base::StringPiece new_tab_html(ResourceBundle::GetSharedInstance(). |
| - GetRawDataResource(IDR_NEW_TAB_4_HTML)); |
| - full_html = jstemplate_builder::GetI18nTemplateHtml(new_tab_html, |
| - &localized_strings); |
| +#if defined(TOUCH_UI) |
|
Rick Byers
2011/09/26 16:05:26
Ugh - sure will be nice to move touch_ui to NTP4 a
|
| + base::StringPiece new_tab_html(ResourceBundle::GetSharedInstance(). |
| + GetRawDataResource(IDR_NEW_TAB_HTML)); |
| + |
| + // Inject the template data into the HTML so that it is available before any |
| + // layout is needed. |
| + std::string json_html; |
| + jstemplate_builder::AppendJsonHtml(&localized_strings, &json_html); |
| + |
| + static const base::StringPiece template_data_placeholder( |
| + "<!-- template data placeholder -->"); |
| + size_t pos = new_tab_html.find(template_data_placeholder); |
| + |
| + if (pos != base::StringPiece::npos) { |
| + full_html.assign(new_tab_html.data(), pos); |
| + full_html.append(json_html); |
| + size_t after_offset = pos + template_data_placeholder.size(); |
| + full_html.append(new_tab_html.data() + after_offset, |
| + new_tab_html.size() - after_offset); |
| } else { |
| - base::StringPiece new_tab_html(ResourceBundle::GetSharedInstance(). |
| - GetRawDataResource(IDR_NEW_TAB_HTML)); |
| - |
| - // Inject the template data into the HTML so that it is available before any |
| - // layout is needed. |
| - std::string json_html; |
| - jstemplate_builder::AppendJsonHtml(&localized_strings, &json_html); |
| - |
| - static const base::StringPiece template_data_placeholder( |
| - "<!-- template data placeholder -->"); |
| - size_t pos = new_tab_html.find(template_data_placeholder); |
| - |
| - if (pos != base::StringPiece::npos) { |
| - full_html.assign(new_tab_html.data(), pos); |
| - full_html.append(json_html); |
| - size_t after_offset = pos + template_data_placeholder.size(); |
| - full_html.append(new_tab_html.data() + after_offset, |
| - new_tab_html.size() - after_offset); |
| - } else { |
| - NOTREACHED(); |
| - full_html.assign(new_tab_html.data(), new_tab_html.size()); |
| - } |
| + NOTREACHED(); |
| + full_html.assign(new_tab_html.data(), new_tab_html.size()); |
| } |
| +#else |
| + base::StringPiece new_tab_html(ResourceBundle::GetSharedInstance(). |
| + GetRawDataResource(IDR_NEW_TAB_4_HTML)); |
| + full_html = jstemplate_builder::GetI18nTemplateHtml(new_tab_html, |
| + &localized_strings); |
| +#endif |
| new_tab_html_ = base::RefCountedString::TakeString(&full_html); |
| } |
| @@ -578,9 +574,9 @@ void NTPResourceCache::CreateNewTabCSS() { |
| subst.push_back(SkColorToRGBComponents(color_section_border)); // $22 |
| subst.push_back(SkColorToRGBComponents(color_text)); // $23 |
| +#if !defined(TOUCH_UI) |
| // Get our template. |
| - int ntp_css_resource_id = NewTabUI::NTP4Enabled() ? |
| - IDR_NEW_TAB_4_THEME_CSS : IDR_NEW_TAB_THEME_CSS; |
| + int ntp_css_resource_id = IDR_NEW_TAB_4_THEME_CSS; |
| static const base::StringPiece new_tab_theme_css( |
| ResourceBundle::GetSharedInstance().GetRawDataResource( |
| ntp_css_resource_id)); |
| @@ -589,4 +585,5 @@ void NTPResourceCache::CreateNewTabCSS() { |
| std::string css_string; |
| css_string = ReplaceStringPlaceholders(new_tab_theme_css, subst, NULL); |
| new_tab_css_ = base::RefCountedString::TakeString(&css_string); |
|
Rick Byers
2011/09/26 16:05:26
I know touch_ntp doesn't rely on any of the theme
|
| +#endif |
| } |