| 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 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 255 std::string full_html = jstemplate_builder::GetI18nTemplateHtml( | 255 std::string full_html = jstemplate_builder::GetI18nTemplateHtml( |
| 256 incognito_tab_html, &localized_strings); | 256 incognito_tab_html, &localized_strings); |
| 257 | 257 |
| 258 new_tab_incognito_html_ = new RefCountedBytes; | 258 new_tab_incognito_html_ = new RefCountedBytes; |
| 259 new_tab_incognito_html_->data.resize(full_html.size()); | 259 new_tab_incognito_html_->data.resize(full_html.size()); |
| 260 std::copy(full_html.begin(), full_html.end(), | 260 std::copy(full_html.begin(), full_html.end(), |
| 261 new_tab_incognito_html_->data.begin()); | 261 new_tab_incognito_html_->data.begin()); |
| 262 } | 262 } |
| 263 | 263 |
| 264 void NTPResourceCache::CreateNewTabHTML() { | 264 void NTPResourceCache::CreateNewTabHTML() { |
| 265 // TODO(estade): these strings should be defined in their relevant handlers |
| 266 // (in GetLocalizedValues) and should have more legible names. |
| 265 // Show the profile name in the title and most visited labels if the current | 267 // Show the profile name in the title and most visited labels if the current |
| 266 // profile is not the default. | 268 // profile is not the default. |
| 267 string16 apps = l10n_util::GetStringUTF16(IDS_NEW_TAB_APPS); | 269 string16 apps = l10n_util::GetStringUTF16(IDS_NEW_TAB_APPS); |
| 268 string16 title = l10n_util::GetStringUTF16(IDS_NEW_TAB_TITLE); | 270 string16 title = l10n_util::GetStringUTF16(IDS_NEW_TAB_TITLE); |
| 269 string16 most_visited = l10n_util::GetStringUTF16(IDS_NEW_TAB_MOST_VISITED); | 271 string16 most_visited = l10n_util::GetStringUTF16(IDS_NEW_TAB_MOST_VISITED); |
| 270 DictionaryValue localized_strings; | 272 DictionaryValue localized_strings; |
| 271 localized_strings.SetString("bookmarkbarattached", | 273 localized_strings.SetString("bookmarkbarattached", |
| 272 profile_->GetPrefs()->GetBoolean(prefs::kShowBookmarkBar) ? | 274 profile_->GetPrefs()->GetBoolean(prefs::kShowBookmarkBar) ? |
| 273 "true" : "false"); | 275 "true" : "false"); |
| 274 localized_strings.SetString("hasattribution", | 276 localized_strings.SetString("hasattribution", |
| (...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 558 ntp_css_resource_id)); | 560 ntp_css_resource_id)); |
| 559 | 561 |
| 560 // Create the string from our template and the replacements. | 562 // Create the string from our template and the replacements. |
| 561 std::string css_string; | 563 std::string css_string; |
| 562 css_string = ReplaceStringPlaceholders(new_tab_theme_css, subst, NULL); | 564 css_string = ReplaceStringPlaceholders(new_tab_theme_css, subst, NULL); |
| 563 new_tab_css_ = new RefCountedBytes; | 565 new_tab_css_ = new RefCountedBytes; |
| 564 new_tab_css_->data.resize(css_string.size()); | 566 new_tab_css_->data.resize(css_string.size()); |
| 565 std::copy(css_string.begin(), css_string.end(), | 567 std::copy(css_string.begin(), css_string.end(), |
| 566 new_tab_css_->data.begin()); | 568 new_tab_css_->data.begin()); |
| 567 } | 569 } |
| OLD | NEW |