| OLD | NEW |
| 1 // Copyright 2012 The Chromium Authors. All rights reserved. | 1 // Copyright 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 351 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 362 localized_strings.SetString("learnMore", | 362 localized_strings.SetString("learnMore", |
| 363 l10n_util::GetStringUTF16(guest_tab_link_ids)); | 363 l10n_util::GetStringUTF16(guest_tab_link_ids)); |
| 364 localized_strings.SetString("learnMoreLink", guest_tab_link); | 364 localized_strings.SetString("learnMoreLink", guest_tab_link); |
| 365 | 365 |
| 366 const std::string& app_locale = g_browser_process->GetApplicationLocale(); | 366 const std::string& app_locale = g_browser_process->GetApplicationLocale(); |
| 367 webui::SetLoadTimeDataDefaults(app_locale, &localized_strings); | 367 webui::SetLoadTimeDataDefaults(app_locale, &localized_strings); |
| 368 | 368 |
| 369 static const base::StringPiece guest_tab_html( | 369 static const base::StringPiece guest_tab_html( |
| 370 ResourceBundle::GetSharedInstance().GetRawDataResource(guest_tab_ids)); | 370 ResourceBundle::GetSharedInstance().GetRawDataResource(guest_tab_ids)); |
| 371 | 371 |
| 372 #if defined(OS_CHROMEOS) |
| 373 // TODO(dbeam): convert c/b/resources/chromeos/guest_session_tab.html from |
| 374 // i18n-* to $i18n{}. |
| 372 std::string full_html = webui::GetI18nTemplateHtml( | 375 std::string full_html = webui::GetI18nTemplateHtml( |
| 373 guest_tab_html, &localized_strings); | 376 guest_tab_html, &localized_strings); |
| 377 #else |
| 378 ui::TemplateReplacements replacements; |
| 379 ui::TemplateReplacementsFromDictionaryValue(localized_strings, &replacements); |
| 380 std::string full_html = |
| 381 ui::ReplaceTemplateExpressions(guest_tab_html, replacements); |
| 382 #endif |
| 374 | 383 |
| 375 new_tab_guest_html_ = base::RefCountedString::TakeString(&full_html); | 384 new_tab_guest_html_ = base::RefCountedString::TakeString(&full_html); |
| 376 } | 385 } |
| 377 | 386 |
| 378 void NTPResourceCache::CreateNewTabHTML() { | 387 void NTPResourceCache::CreateNewTabHTML() { |
| 379 // TODO(estade): these strings should be defined in their relevant handlers | 388 // TODO(estade): these strings should be defined in their relevant handlers |
| 380 // (in GetLocalizedValues) and should have more legible names. | 389 // (in GetLocalizedValues) and should have more legible names. |
| 381 // Show the profile name in the title and most visited labels if the current | 390 // Show the profile name in the title and most visited labels if the current |
| 382 // profile is not the default. | 391 // profile is not the default. |
| 383 PrefService* prefs = profile_->GetPrefs(); | 392 PrefService* prefs = profile_->GetPrefs(); |
| (...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 584 // Get our template. | 593 // Get our template. |
| 585 static const base::StringPiece new_tab_theme_css( | 594 static const base::StringPiece new_tab_theme_css( |
| 586 ResourceBundle::GetSharedInstance().GetRawDataResource( | 595 ResourceBundle::GetSharedInstance().GetRawDataResource( |
| 587 IDR_NEW_TAB_4_THEME_CSS)); | 596 IDR_NEW_TAB_4_THEME_CSS)); |
| 588 | 597 |
| 589 // Create the string from our template and the replacements. | 598 // Create the string from our template and the replacements. |
| 590 std::string css_string = | 599 std::string css_string = |
| 591 ui::ReplaceTemplateExpressions(new_tab_theme_css, substitutions); | 600 ui::ReplaceTemplateExpressions(new_tab_theme_css, substitutions); |
| 592 new_tab_css_ = base::RefCountedString::TakeString(&css_string); | 601 new_tab_css_ = base::RefCountedString::TakeString(&css_string); |
| 593 } | 602 } |
| OLD | NEW |