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 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
152 | 152 |
153 // How the background image on the new tab page should be tiled (see tiling | 153 // How the background image on the new tab page should be tiled (see tiling |
154 // masks in theme_service.h). | 154 // masks in theme_service.h). |
155 std::string GetNewTabBackgroundTilingCSS( | 155 std::string GetNewTabBackgroundTilingCSS( |
156 const ui::ThemeProvider* theme_provider) { | 156 const ui::ThemeProvider* theme_provider) { |
157 int repeat_mode = theme_provider->GetDisplayProperty( | 157 int repeat_mode = theme_provider->GetDisplayProperty( |
158 ThemeProperties::NTP_BACKGROUND_TILING); | 158 ThemeProperties::NTP_BACKGROUND_TILING); |
159 return ThemeProperties::TilingToString(repeat_mode); | 159 return ThemeProperties::TilingToString(repeat_mode); |
160 } | 160 } |
161 | 161 |
162 bool ShouldDisplayAppInfoDialog() { | |
tsergeant
2015/02/05 05:33:27
Is there a good way to avoid adding new logic to f
sashab
2015/02/06 16:23:00
Hmm... This would be perfect as a static method to
tsergeant
2015/02/09 03:10:49
I already tried something similar. Adding a method
sashab
2015/02/09 11:47:07
Don't really want to put it in switches, since tha
| |
163 #if defined(OS_MACOSX) | |
164 return false; | |
165 #else | |
166 return true; | |
167 #endif | |
168 } | |
169 | |
162 } // namespace | 170 } // namespace |
163 | 171 |
164 NTPResourceCache::NTPResourceCache(Profile* profile) | 172 NTPResourceCache::NTPResourceCache(Profile* profile) |
165 : profile_(profile), is_swipe_tracking_from_scroll_events_enabled_(false), | 173 : profile_(profile), is_swipe_tracking_from_scroll_events_enabled_(false), |
166 should_show_apps_page_(NewTabUI::ShouldShowApps()), | 174 should_show_apps_page_(NewTabUI::ShouldShowApps()), |
167 should_show_most_visited_page_(true), | 175 should_show_most_visited_page_(true), |
168 should_show_other_devices_menu_(true), | 176 should_show_other_devices_menu_(true), |
169 should_show_recently_closed_menu_(true) { | 177 should_show_recently_closed_menu_(true) { |
170 registrar_.Add(this, chrome::NOTIFICATION_BROWSER_THEME_CHANGED, | 178 registrar_.Add(this, chrome::NOTIFICATION_BROWSER_THEME_CHANGED, |
171 content::Source<ThemeService>( | 179 content::Source<ThemeService>( |
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
432 load_time_data.SetString("undothumbnailremove", | 440 load_time_data.SetString("undothumbnailremove", |
433 l10n_util::GetStringUTF16(IDS_NEW_TAB_UNDO_THUMBNAIL_REMOVE)); | 441 l10n_util::GetStringUTF16(IDS_NEW_TAB_UNDO_THUMBNAIL_REMOVE)); |
434 load_time_data.SetString("removethumbnailtooltip", | 442 load_time_data.SetString("removethumbnailtooltip", |
435 l10n_util::GetStringUTF16(IDS_NEW_TAB_REMOVE_THUMBNAIL_TOOLTIP)); | 443 l10n_util::GetStringUTF16(IDS_NEW_TAB_REMOVE_THUMBNAIL_TOOLTIP)); |
436 load_time_data.SetString("appuninstall", | 444 load_time_data.SetString("appuninstall", |
437 l10n_util::GetStringUTF16(IDS_EXTENSIONS_UNINSTALL)); | 445 l10n_util::GetStringUTF16(IDS_EXTENSIONS_UNINSTALL)); |
438 load_time_data.SetString("appoptions", | 446 load_time_data.SetString("appoptions", |
439 l10n_util::GetStringUTF16(IDS_NEW_TAB_APP_OPTIONS)); | 447 l10n_util::GetStringUTF16(IDS_NEW_TAB_APP_OPTIONS)); |
440 load_time_data.SetString("appdetails", | 448 load_time_data.SetString("appdetails", |
441 l10n_util::GetStringUTF16(IDS_NEW_TAB_APP_DETAILS)); | 449 l10n_util::GetStringUTF16(IDS_NEW_TAB_APP_DETAILS)); |
450 load_time_data.SetString("appinfodialog", | |
451 l10n_util::GetStringUTF16(IDS_NEW_TAB_APP_INFO)); | |
442 load_time_data.SetString("appcreateshortcut", | 452 load_time_data.SetString("appcreateshortcut", |
443 l10n_util::GetStringUTF16(IDS_NEW_TAB_APP_CREATE_SHORTCUT)); | 453 l10n_util::GetStringUTF16(IDS_NEW_TAB_APP_CREATE_SHORTCUT)); |
444 load_time_data.SetString("appDefaultPageName", | 454 load_time_data.SetString("appDefaultPageName", |
445 l10n_util::GetStringUTF16(IDS_APP_DEFAULT_PAGE_NAME)); | 455 l10n_util::GetStringUTF16(IDS_APP_DEFAULT_PAGE_NAME)); |
446 load_time_data.SetString("applaunchtypepinned", | 456 load_time_data.SetString("applaunchtypepinned", |
447 l10n_util::GetStringUTF16(IDS_APP_CONTEXT_MENU_OPEN_PINNED)); | 457 l10n_util::GetStringUTF16(IDS_APP_CONTEXT_MENU_OPEN_PINNED)); |
448 load_time_data.SetString("applaunchtyperegular", | 458 load_time_data.SetString("applaunchtyperegular", |
449 l10n_util::GetStringUTF16(IDS_APP_CONTEXT_MENU_OPEN_REGULAR)); | 459 l10n_util::GetStringUTF16(IDS_APP_CONTEXT_MENU_OPEN_REGULAR)); |
450 load_time_data.SetString("applaunchtypewindow", | 460 load_time_data.SetString("applaunchtypewindow", |
451 l10n_util::GetStringUTF16(IDS_APP_CONTEXT_MENU_OPEN_WINDOW)); | 461 l10n_util::GetStringUTF16(IDS_APP_CONTEXT_MENU_OPEN_WINDOW)); |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
501 | 511 |
502 bool bookmark_apps_enabled = extensions::util::IsNewBookmarkAppsEnabled(); | 512 bool bookmark_apps_enabled = extensions::util::IsNewBookmarkAppsEnabled(); |
503 load_time_data.SetBoolean("enableNewBookmarkApps", bookmark_apps_enabled); | 513 load_time_data.SetBoolean("enableNewBookmarkApps", bookmark_apps_enabled); |
504 // Use a different string for launching as a regular tab when bookmark apps | 514 // Use a different string for launching as a regular tab when bookmark apps |
505 // are enabled. | 515 // are enabled. |
506 if (bookmark_apps_enabled) { | 516 if (bookmark_apps_enabled) { |
507 load_time_data.SetString("applaunchtypetab", | 517 load_time_data.SetString("applaunchtypetab", |
508 l10n_util::GetStringUTF16(IDS_APP_CONTEXT_MENU_OPEN_TAB)); | 518 l10n_util::GetStringUTF16(IDS_APP_CONTEXT_MENU_OPEN_TAB)); |
509 } | 519 } |
510 | 520 |
521 load_time_data.SetBoolean("enableAppInfoDialog", | |
522 ShouldDisplayAppInfoDialog()); | |
523 | |
511 #if defined(OS_CHROMEOS) | 524 #if defined(OS_CHROMEOS) |
512 load_time_data.SetString("expandMenu", | 525 load_time_data.SetString("expandMenu", |
513 l10n_util::GetStringUTF16(IDS_NEW_TAB_CLOSE_MENU_EXPAND)); | 526 l10n_util::GetStringUTF16(IDS_NEW_TAB_CLOSE_MENU_EXPAND)); |
514 #endif | 527 #endif |
515 | 528 |
516 NewTabPageHandler::GetLocalizedValues(profile_, &load_time_data); | 529 NewTabPageHandler::GetLocalizedValues(profile_, &load_time_data); |
517 NTPLoginHandler::GetLocalizedValues(profile_, &load_time_data); | 530 NTPLoginHandler::GetLocalizedValues(profile_, &load_time_data); |
518 | 531 |
519 webui::SetLoadTimeDataDefaults(app_locale, &load_time_data); | 532 webui::SetLoadTimeDataDefaults(app_locale, &load_time_data); |
520 | 533 |
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
720 // Get our template. | 733 // Get our template. |
721 static const base::StringPiece new_tab_theme_css( | 734 static const base::StringPiece new_tab_theme_css( |
722 ResourceBundle::GetSharedInstance().GetRawDataResource( | 735 ResourceBundle::GetSharedInstance().GetRawDataResource( |
723 IDR_NEW_TAB_4_THEME_CSS)); | 736 IDR_NEW_TAB_4_THEME_CSS)); |
724 | 737 |
725 // Create the string from our template and the replacements. | 738 // Create the string from our template and the replacements. |
726 std::string css_string; | 739 std::string css_string; |
727 css_string = ReplaceStringPlaceholders(new_tab_theme_css, subst, NULL); | 740 css_string = ReplaceStringPlaceholders(new_tab_theme_css, subst, NULL); |
728 new_tab_css_ = base::RefCountedString::TakeString(&css_string); | 741 new_tab_css_ = base::RefCountedString::TakeString(&css_string); |
729 } | 742 } |
OLD | NEW |