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 13 matching lines...) Expand all Loading... | |
24 #include "chrome/browser/signin/signin_manager_factory.h" | 24 #include "chrome/browser/signin/signin_manager_factory.h" |
25 #include "chrome/browser/sync/profile_sync_service.h" | 25 #include "chrome/browser/sync/profile_sync_service.h" |
26 #include "chrome/browser/sync/profile_sync_service_factory.h" | 26 #include "chrome/browser/sync/profile_sync_service_factory.h" |
27 #include "chrome/browser/themes/theme_properties.h" | 27 #include "chrome/browser/themes/theme_properties.h" |
28 #include "chrome/browser/themes/theme_service.h" | 28 #include "chrome/browser/themes/theme_service.h" |
29 #include "chrome/browser/themes/theme_service_factory.h" | 29 #include "chrome/browser/themes/theme_service_factory.h" |
30 #include "chrome/browser/ui/app_list/app_list_util.h" | 30 #include "chrome/browser/ui/app_list/app_list_util.h" |
31 #include "chrome/browser/ui/apps/app_info_dialog.h" | 31 #include "chrome/browser/ui/apps/app_info_dialog.h" |
32 #include "chrome/browser/ui/bookmarks/bookmark_bar_constants.h" | 32 #include "chrome/browser/ui/bookmarks/bookmark_bar_constants.h" |
33 #include "chrome/browser/ui/sync/sync_promo_ui.h" | 33 #include "chrome/browser/ui/sync/sync_promo_ui.h" |
34 #include "chrome/browser/ui/webui/app_launcher_login_handler.h" | |
34 #include "chrome/browser/ui/webui/ntp/new_tab_page_handler.h" | 35 #include "chrome/browser/ui/webui/ntp/new_tab_page_handler.h" |
35 #include "chrome/browser/ui/webui/ntp/new_tab_ui.h" | 36 #include "chrome/browser/ui/webui/ntp/new_tab_ui.h" |
36 #include "chrome/browser/ui/webui/ntp/ntp_login_handler.h" | |
37 #include "chrome/browser/web_resource/notification_promo.h" | 37 #include "chrome/browser/web_resource/notification_promo.h" |
38 #include "chrome/common/chrome_switches.h" | 38 #include "chrome/common/chrome_switches.h" |
39 #include "chrome/common/pref_names.h" | 39 #include "chrome/common/pref_names.h" |
40 #include "chrome/common/url_constants.h" | 40 #include "chrome/common/url_constants.h" |
41 #include "chrome/grit/chromium_strings.h" | 41 #include "chrome/grit/chromium_strings.h" |
42 #include "chrome/grit/generated_resources.h" | 42 #include "chrome/grit/generated_resources.h" |
43 #include "chrome/grit/locale_settings.h" | 43 #include "chrome/grit/locale_settings.h" |
44 #include "components/google/core/browser/google_util.h" | 44 #include "components/google/core/browser/google_util.h" |
45 #include "components/signin/core/browser/signin_manager.h" | 45 #include "components/signin/core/browser/signin_manager.h" |
46 #include "content/public/browser/browser_thread.h" | 46 #include "content/public/browser/browser_thread.h" |
(...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
453 l10n_util::GetStringUTF16(IDS_APP_CONTEXT_MENU_OPEN_REGULAR)); | 453 l10n_util::GetStringUTF16(IDS_APP_CONTEXT_MENU_OPEN_REGULAR)); |
454 load_time_data.SetString("applaunchtypewindow", | 454 load_time_data.SetString("applaunchtypewindow", |
455 l10n_util::GetStringUTF16(IDS_APP_CONTEXT_MENU_OPEN_WINDOW)); | 455 l10n_util::GetStringUTF16(IDS_APP_CONTEXT_MENU_OPEN_WINDOW)); |
456 load_time_data.SetString("applaunchtypefullscreen", | 456 load_time_data.SetString("applaunchtypefullscreen", |
457 l10n_util::GetStringUTF16(IDS_APP_CONTEXT_MENU_OPEN_FULLSCREEN)); | 457 l10n_util::GetStringUTF16(IDS_APP_CONTEXT_MENU_OPEN_FULLSCREEN)); |
458 load_time_data.SetString("syncpromotext", | 458 load_time_data.SetString("syncpromotext", |
459 l10n_util::GetStringUTF16(IDS_SYNC_START_SYNC_BUTTON_LABEL)); | 459 l10n_util::GetStringUTF16(IDS_SYNC_START_SYNC_BUTTON_LABEL)); |
460 load_time_data.SetString("syncLinkText", | 460 load_time_data.SetString("syncLinkText", |
461 l10n_util::GetStringUTF16(IDS_SYNC_ADVANCED_OPTIONS)); | 461 l10n_util::GetStringUTF16(IDS_SYNC_ADVANCED_OPTIONS)); |
462 load_time_data.SetBoolean("shouldShowSyncLogin", | 462 load_time_data.SetBoolean("shouldShowSyncLogin", |
463 NTPLoginHandler::ShouldShow(profile_)); | 463 AppLauncherLoginHandler::ShouldShow(profile_)); |
Dan Beam
2015/05/20 02:44:04
will probably need to futz with this later...
| |
464 load_time_data.SetString("learnMore", | 464 load_time_data.SetString("learnMore", |
465 l10n_util::GetStringUTF16(IDS_LEARN_MORE)); | 465 l10n_util::GetStringUTF16(IDS_LEARN_MORE)); |
466 const std::string& app_locale = g_browser_process->GetApplicationLocale(); | 466 const std::string& app_locale = g_browser_process->GetApplicationLocale(); |
467 load_time_data.SetString("webStoreLink", | 467 load_time_data.SetString("webStoreLink", |
468 google_util::AppendGoogleLocaleParam( | 468 google_util::AppendGoogleLocaleParam( |
469 GURL(extension_urls::GetWebstoreLaunchURL()), app_locale).spec()); | 469 GURL(extension_urls::GetWebstoreLaunchURL()), app_locale).spec()); |
470 load_time_data.SetString("appInstallHintText", | 470 load_time_data.SetString("appInstallHintText", |
471 l10n_util::GetStringUTF16(IDS_NEW_TAB_APP_INSTALL_HINT_LABEL)); | 471 l10n_util::GetStringUTF16(IDS_NEW_TAB_APP_INSTALL_HINT_LABEL)); |
472 load_time_data.SetString("learn_more", | 472 load_time_data.SetString("learn_more", |
473 l10n_util::GetStringUTF16(IDS_LEARN_MORE)); | 473 l10n_util::GetStringUTF16(IDS_LEARN_MORE)); |
(...skipping 20 matching lines...) Expand all Loading... | |
494 | 494 |
495 load_time_data.SetBoolean("canShowAppInfoDialog", | 495 load_time_data.SetBoolean("canShowAppInfoDialog", |
496 CanShowAppInfoDialog()); | 496 CanShowAppInfoDialog()); |
497 | 497 |
498 #if defined(OS_CHROMEOS) | 498 #if defined(OS_CHROMEOS) |
499 load_time_data.SetString("expandMenu", | 499 load_time_data.SetString("expandMenu", |
500 l10n_util::GetStringUTF16(IDS_NEW_TAB_CLOSE_MENU_EXPAND)); | 500 l10n_util::GetStringUTF16(IDS_NEW_TAB_CLOSE_MENU_EXPAND)); |
501 #endif | 501 #endif |
502 | 502 |
503 NewTabPageHandler::GetLocalizedValues(profile_, &load_time_data); | 503 NewTabPageHandler::GetLocalizedValues(profile_, &load_time_data); |
504 NTPLoginHandler::GetLocalizedValues(profile_, &load_time_data); | 504 AppLauncherLoginHandler::GetLocalizedValues(profile_, &load_time_data); |
505 | 505 |
506 webui::SetLoadTimeDataDefaults(app_locale, &load_time_data); | 506 webui::SetLoadTimeDataDefaults(app_locale, &load_time_data); |
507 | 507 |
508 // Control fade and resize animations. | 508 // Control fade and resize animations. |
509 load_time_data.SetBoolean("anim", | 509 load_time_data.SetBoolean("anim", |
510 gfx::Animation::ShouldRenderRichAnimation()); | 510 gfx::Animation::ShouldRenderRichAnimation()); |
511 | 511 |
512 ui::ThemeProvider* tp = ThemeServiceFactory::GetForProfile(profile_); | 512 ui::ThemeProvider* tp = ThemeServiceFactory::GetForProfile(profile_); |
513 int alignment = tp->GetDisplayProperty( | 513 int alignment = tp->GetDisplayProperty( |
514 ThemeProperties::NTP_BACKGROUND_ALIGNMENT); | 514 ThemeProperties::NTP_BACKGROUND_ALIGNMENT); |
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
701 // Get our template. | 701 // Get our template. |
702 static const base::StringPiece new_tab_theme_css( | 702 static const base::StringPiece new_tab_theme_css( |
703 ResourceBundle::GetSharedInstance().GetRawDataResource( | 703 ResourceBundle::GetSharedInstance().GetRawDataResource( |
704 IDR_NEW_TAB_4_THEME_CSS)); | 704 IDR_NEW_TAB_4_THEME_CSS)); |
705 | 705 |
706 // Create the string from our template and the replacements. | 706 // Create the string from our template and the replacements. |
707 std::string css_string; | 707 std::string css_string; |
708 css_string = ReplaceStringPlaceholders(new_tab_theme_css, subst, NULL); | 708 css_string = ReplaceStringPlaceholders(new_tab_theme_css, subst, NULL); |
709 new_tab_css_ = base::RefCountedString::TakeString(&css_string); | 709 new_tab_css_ = base::RefCountedString::TakeString(&css_string); |
710 } | 710 } |
OLD | NEW |