| 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() { |
| 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_APP_CONTEXT_MENU_SHOW_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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 495 load_time_data.SetBoolean("isSwipeTrackingFromScrollEventsEnabled", | 505 load_time_data.SetBoolean("isSwipeTrackingFromScrollEventsEnabled", |
| 496 is_swipe_tracking_from_scroll_events_enabled_); | 506 is_swipe_tracking_from_scroll_events_enabled_); |
| 497 | 507 |
| 498 load_time_data.SetBoolean("showApps", should_show_apps_page_); | 508 load_time_data.SetBoolean("showApps", should_show_apps_page_); |
| 499 load_time_data.SetBoolean("showWebStoreIcon", | 509 load_time_data.SetBoolean("showWebStoreIcon", |
| 500 !prefs->GetBoolean(prefs::kHideWebStoreIcon)); | 510 !prefs->GetBoolean(prefs::kHideWebStoreIcon)); |
| 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 | 514 |
| 515 load_time_data.SetBoolean("canShowAppInfoDialog", |
| 516 ShouldDisplayAppInfoDialog()); |
| 517 |
| 505 #if defined(OS_CHROMEOS) | 518 #if defined(OS_CHROMEOS) |
| 506 load_time_data.SetString("expandMenu", | 519 load_time_data.SetString("expandMenu", |
| 507 l10n_util::GetStringUTF16(IDS_NEW_TAB_CLOSE_MENU_EXPAND)); | 520 l10n_util::GetStringUTF16(IDS_NEW_TAB_CLOSE_MENU_EXPAND)); |
| 508 #endif | 521 #endif |
| 509 | 522 |
| 510 NewTabPageHandler::GetLocalizedValues(profile_, &load_time_data); | 523 NewTabPageHandler::GetLocalizedValues(profile_, &load_time_data); |
| 511 NTPLoginHandler::GetLocalizedValues(profile_, &load_time_data); | 524 NTPLoginHandler::GetLocalizedValues(profile_, &load_time_data); |
| 512 | 525 |
| 513 webui::SetLoadTimeDataDefaults(app_locale, &load_time_data); | 526 webui::SetLoadTimeDataDefaults(app_locale, &load_time_data); |
| 514 | 527 |
| (...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 714 // Get our template. | 727 // Get our template. |
| 715 static const base::StringPiece new_tab_theme_css( | 728 static const base::StringPiece new_tab_theme_css( |
| 716 ResourceBundle::GetSharedInstance().GetRawDataResource( | 729 ResourceBundle::GetSharedInstance().GetRawDataResource( |
| 717 IDR_NEW_TAB_4_THEME_CSS)); | 730 IDR_NEW_TAB_4_THEME_CSS)); |
| 718 | 731 |
| 719 // Create the string from our template and the replacements. | 732 // Create the string from our template and the replacements. |
| 720 std::string css_string; | 733 std::string css_string; |
| 721 css_string = ReplaceStringPlaceholders(new_tab_theme_css, subst, NULL); | 734 css_string = ReplaceStringPlaceholders(new_tab_theme_css, subst, NULL); |
| 722 new_tab_css_ = base::RefCountedString::TakeString(&css_string); | 735 new_tab_css_ = base::RefCountedString::TakeString(&css_string); |
| 723 } | 736 } |
| OLD | NEW |