| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 303 localized_strings.SetString("incognitoTabDescription", | 303 localized_strings.SetString("incognitoTabDescription", |
| 304 l10n_util::GetStringUTF16(new_tab_description_ids)); | 304 l10n_util::GetStringUTF16(new_tab_description_ids)); |
| 305 localized_strings.SetString("incognitoTabHeading", | 305 localized_strings.SetString("incognitoTabHeading", |
| 306 l10n_util::GetStringUTF16(new_tab_heading_ids)); | 306 l10n_util::GetStringUTF16(new_tab_heading_ids)); |
| 307 localized_strings.SetString("incognitoTabWarning", | 307 localized_strings.SetString("incognitoTabWarning", |
| 308 l10n_util::GetStringUTF16(new_tab_warning_ids)); | 308 l10n_util::GetStringUTF16(new_tab_warning_ids)); |
| 309 } | 309 } |
| 310 | 310 |
| 311 localized_strings.SetString("learnMore", | 311 localized_strings.SetString("learnMore", |
| 312 l10n_util::GetStringUTF16(new_tab_link_ids)); | 312 l10n_util::GetStringUTF16(new_tab_link_ids)); |
| 313 localized_strings.SetString("learnMoreLink", GURL(new_tab_link).spec()); | 313 localized_strings.SetString("learnMoreLink", new_tab_link); |
| 314 | 314 |
| 315 bool bookmark_bar_attached = profile_->GetPrefs()->GetBoolean( | 315 bool bookmark_bar_attached = profile_->GetPrefs()->GetBoolean( |
| 316 prefs::kShowBookmarkBar); | 316 prefs::kShowBookmarkBar); |
| 317 localized_strings.SetBoolean("bookmarkbarattached", bookmark_bar_attached); | 317 localized_strings.SetBoolean("bookmarkbarattached", bookmark_bar_attached); |
| 318 | 318 |
| 319 webui::SetFontAndTextDirection(&localized_strings); | 319 webui::SetFontAndTextDirection(&localized_strings); |
| 320 | 320 |
| 321 static const base::StringPiece incognito_tab_html( | 321 static const base::StringPiece incognito_tab_html( |
| 322 ResourceBundle::GetSharedInstance().GetRawDataResource( | 322 ResourceBundle::GetSharedInstance().GetRawDataResource( |
| 323 new_tab_html_idr)); | 323 new_tab_html_idr)); |
| (...skipping 25 matching lines...) Expand all Loading... |
| 349 if (!enterprise_domain.empty()) { | 349 if (!enterprise_domain.empty()) { |
| 350 // Device is enterprise enrolled. | 350 // Device is enterprise enrolled. |
| 351 localized_strings.SetString("enterpriseInfoVisible", "true"); | 351 localized_strings.SetString("enterpriseInfoVisible", "true"); |
| 352 base::string16 enterprise_info = l10n_util::GetStringFUTF16( | 352 base::string16 enterprise_info = l10n_util::GetStringFUTF16( |
| 353 IDS_DEVICE_OWNED_BY_NOTICE, | 353 IDS_DEVICE_OWNED_BY_NOTICE, |
| 354 base::UTF8ToUTF16(enterprise_domain)); | 354 base::UTF8ToUTF16(enterprise_domain)); |
| 355 localized_strings.SetString("enterpriseInfoMessage", enterprise_info); | 355 localized_strings.SetString("enterpriseInfoMessage", enterprise_info); |
| 356 localized_strings.SetString("enterpriseLearnMore", | 356 localized_strings.SetString("enterpriseLearnMore", |
| 357 l10n_util::GetStringUTF16(IDS_LEARN_MORE)); | 357 l10n_util::GetStringUTF16(IDS_LEARN_MORE)); |
| 358 localized_strings.SetString("enterpriseInfoHintLink", | 358 localized_strings.SetString("enterpriseInfoHintLink", |
| 359 GURL(chrome::kLearnMoreEnterpriseURL).spec()); | 359 chrome::kLearnMoreEnterpriseURL); |
| 360 } else { | 360 } else { |
| 361 localized_strings.SetString("enterpriseInfoVisible", "false"); | 361 localized_strings.SetString("enterpriseInfoVisible", "false"); |
| 362 } | 362 } |
| 363 #endif | 363 #endif |
| 364 | 364 |
| 365 localized_strings.SetString("guestTabDescription", | 365 localized_strings.SetString("guestTabDescription", |
| 366 l10n_util::GetStringUTF16(guest_tab_description_ids)); | 366 l10n_util::GetStringUTF16(guest_tab_description_ids)); |
| 367 localized_strings.SetString("guestTabHeading", | 367 localized_strings.SetString("guestTabHeading", |
| 368 l10n_util::GetStringUTF16(guest_tab_heading_ids)); | 368 l10n_util::GetStringUTF16(guest_tab_heading_ids)); |
| 369 localized_strings.SetString("learnMore", | 369 localized_strings.SetString("learnMore", |
| 370 l10n_util::GetStringUTF16(guest_tab_link_ids)); | 370 l10n_util::GetStringUTF16(guest_tab_link_ids)); |
| 371 localized_strings.SetString("learnMoreLink", | 371 localized_strings.SetString("learnMoreLink", guest_tab_link); |
| 372 GURL(guest_tab_link).spec()); | |
| 373 | 372 |
| 374 webui::SetFontAndTextDirection(&localized_strings); | 373 webui::SetFontAndTextDirection(&localized_strings); |
| 375 | 374 |
| 376 static const base::StringPiece guest_tab_html( | 375 static const base::StringPiece guest_tab_html( |
| 377 ResourceBundle::GetSharedInstance().GetRawDataResource(guest_tab_ids)); | 376 ResourceBundle::GetSharedInstance().GetRawDataResource(guest_tab_ids)); |
| 378 | 377 |
| 379 std::string full_html = webui::GetI18nTemplateHtml( | 378 std::string full_html = webui::GetI18nTemplateHtml( |
| 380 guest_tab_html, &localized_strings); | 379 guest_tab_html, &localized_strings); |
| 381 | 380 |
| 382 new_tab_guest_html_ = base::RefCountedString::TakeString(&full_html); | 381 new_tab_guest_html_ = base::RefCountedString::TakeString(&full_html); |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 452 load_time_data.SetString("otherSessions", | 451 load_time_data.SetString("otherSessions", |
| 453 l10n_util::GetStringUTF16(IDS_NEW_TAB_OTHER_SESSIONS_LABEL)); | 452 l10n_util::GetStringUTF16(IDS_NEW_TAB_OTHER_SESSIONS_LABEL)); |
| 454 load_time_data.SetString("otherSessionsEmpty", | 453 load_time_data.SetString("otherSessionsEmpty", |
| 455 l10n_util::GetStringUTF16(IDS_NEW_TAB_OTHER_SESSIONS_EMPTY)); | 454 l10n_util::GetStringUTF16(IDS_NEW_TAB_OTHER_SESSIONS_EMPTY)); |
| 456 load_time_data.SetString("otherSessionsLearnMoreUrl", | 455 load_time_data.SetString("otherSessionsLearnMoreUrl", |
| 457 l10n_util::GetStringUTF16(IDS_NEW_TAB_OTHER_SESSIONS_LEARN_MORE_URL)); | 456 l10n_util::GetStringUTF16(IDS_NEW_TAB_OTHER_SESSIONS_LEARN_MORE_URL)); |
| 458 load_time_data.SetString("learnMore", | 457 load_time_data.SetString("learnMore", |
| 459 l10n_util::GetStringUTF16(IDS_LEARN_MORE)); | 458 l10n_util::GetStringUTF16(IDS_LEARN_MORE)); |
| 460 load_time_data.SetString("webStoreLink", | 459 load_time_data.SetString("webStoreLink", |
| 461 google_util::AppendGoogleLocaleParam( | 460 google_util::AppendGoogleLocaleParam( |
| 462 GURL(extension_urls::GetWebstoreLaunchURL())).spec()); | 461 GURL(extension_urls::GetWebstoreLaunchURL()), |
| 462 g_browser_process->GetApplicationLocale()).spec()); |
| 463 load_time_data.SetString("appInstallHintText", | 463 load_time_data.SetString("appInstallHintText", |
| 464 l10n_util::GetStringUTF16(IDS_NEW_TAB_APP_INSTALL_HINT_LABEL)); | 464 l10n_util::GetStringUTF16(IDS_NEW_TAB_APP_INSTALL_HINT_LABEL)); |
| 465 load_time_data.SetBoolean("isDiscoveryInNTPEnabled", | 465 load_time_data.SetBoolean("isDiscoveryInNTPEnabled", |
| 466 NewTabUI::IsDiscoveryInNTPEnabled()); | 466 NewTabUI::IsDiscoveryInNTPEnabled()); |
| 467 load_time_data.SetString("collapseSessionMenuItemText", | 467 load_time_data.SetString("collapseSessionMenuItemText", |
| 468 l10n_util::GetStringUTF16(IDS_NEW_TAB_OTHER_SESSIONS_COLLAPSE_SESSION)); | 468 l10n_util::GetStringUTF16(IDS_NEW_TAB_OTHER_SESSIONS_COLLAPSE_SESSION)); |
| 469 load_time_data.SetString("expandSessionMenuItemText", | 469 load_time_data.SetString("expandSessionMenuItemText", |
| 470 l10n_util::GetStringUTF16(IDS_NEW_TAB_OTHER_SESSIONS_EXPAND_SESSION)); | 470 l10n_util::GetStringUTF16(IDS_NEW_TAB_OTHER_SESSIONS_EXPAND_SESSION)); |
| 471 load_time_data.SetString("restoreSessionMenuItemText", | 471 load_time_data.SetString("restoreSessionMenuItemText", |
| 472 l10n_util::GetStringUTF16(IDS_NEW_TAB_OTHER_SESSIONS_OPEN_ALL)); | 472 l10n_util::GetStringUTF16(IDS_NEW_TAB_OTHER_SESSIONS_OPEN_ALL)); |
| (...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 716 // Get our template. | 716 // Get our template. |
| 717 static const base::StringPiece new_tab_theme_css( | 717 static const base::StringPiece new_tab_theme_css( |
| 718 ResourceBundle::GetSharedInstance().GetRawDataResource( | 718 ResourceBundle::GetSharedInstance().GetRawDataResource( |
| 719 IDR_NEW_TAB_4_THEME_CSS)); | 719 IDR_NEW_TAB_4_THEME_CSS)); |
| 720 | 720 |
| 721 // Create the string from our template and the replacements. | 721 // Create the string from our template and the replacements. |
| 722 std::string css_string; | 722 std::string css_string; |
| 723 css_string = ReplaceStringPlaceholders(new_tab_theme_css, subst, NULL); | 723 css_string = ReplaceStringPlaceholders(new_tab_theme_css, subst, NULL); |
| 724 new_tab_css_ = base::RefCountedString::TakeString(&css_string); | 724 new_tab_css_ = base::RefCountedString::TakeString(&css_string); |
| 725 } | 725 } |
| OLD | NEW |