Chromium Code Reviews| 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 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 159 ThemeProperties::NTP_BACKGROUND_TILING); | 159 ThemeProperties::NTP_BACKGROUND_TILING); |
| 160 return ThemeProperties::TilingToString(repeat_mode); | 160 return ThemeProperties::TilingToString(repeat_mode); |
| 161 } | 161 } |
| 162 | 162 |
| 163 } // namespace | 163 } // namespace |
| 164 | 164 |
| 165 NTPResourceCache::NTPResourceCache(Profile* profile) | 165 NTPResourceCache::NTPResourceCache(Profile* profile) |
| 166 : profile_(profile), is_swipe_tracking_from_scroll_events_enabled_(false), | 166 : profile_(profile), is_swipe_tracking_from_scroll_events_enabled_(false), |
| 167 should_show_apps_page_(NewTabUI::ShouldShowApps()), | 167 should_show_apps_page_(NewTabUI::ShouldShowApps()), |
| 168 should_show_most_visited_page_(true), | 168 should_show_most_visited_page_(true), |
| 169 should_show_other_devices_menu_(true), | 169 should_show_other_devices_menu_(true) { |
| 170 should_show_recently_closed_menu_(true) { | |
| 171 registrar_.Add(this, chrome::NOTIFICATION_BROWSER_THEME_CHANGED, | 170 registrar_.Add(this, chrome::NOTIFICATION_BROWSER_THEME_CHANGED, |
| 172 content::Source<ThemeService>( | 171 content::Source<ThemeService>( |
| 173 ThemeServiceFactory::GetForProfile(profile))); | 172 ThemeServiceFactory::GetForProfile(profile))); |
| 174 registrar_.Add(this, chrome::NOTIFICATION_PROMO_RESOURCE_STATE_CHANGED, | 173 registrar_.Add(this, chrome::NOTIFICATION_PROMO_RESOURCE_STATE_CHANGED, |
| 175 content::NotificationService::AllSources()); | 174 content::NotificationService::AllSources()); |
| 176 | 175 |
| 177 PromoResourceService* promo_service = | 176 PromoResourceService* promo_service = |
| 178 g_browser_process->promo_resource_service(); | 177 g_browser_process->promo_resource_service(); |
| 179 if (promo_service) { | 178 if (promo_service) { |
| 180 promo_resource_subscription_ = promo_service->RegisterStateChangedCallback( | 179 promo_resource_subscription_ = promo_service->RegisterStateChangedCallback( |
| (...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 411 PrefService* prefs = profile_->GetPrefs(); | 410 PrefService* prefs = profile_->GetPrefs(); |
| 412 base::DictionaryValue load_time_data; | 411 base::DictionaryValue load_time_data; |
| 413 load_time_data.SetBoolean("bookmarkbarattached", | 412 load_time_data.SetBoolean("bookmarkbarattached", |
| 414 prefs->GetBoolean(bookmarks::prefs::kShowBookmarkBar)); | 413 prefs->GetBoolean(bookmarks::prefs::kShowBookmarkBar)); |
| 415 load_time_data.SetBoolean("hasattribution", | 414 load_time_data.SetBoolean("hasattribution", |
| 416 ThemeServiceFactory::GetForProfile(profile_)->HasCustomImage( | 415 ThemeServiceFactory::GetForProfile(profile_)->HasCustomImage( |
| 417 IDR_THEME_NTP_ATTRIBUTION)); | 416 IDR_THEME_NTP_ATTRIBUTION)); |
| 418 load_time_data.SetBoolean("showMostvisited", should_show_most_visited_page_); | 417 load_time_data.SetBoolean("showMostvisited", should_show_most_visited_page_); |
| 419 load_time_data.SetBoolean("showAppLauncherPromo", | 418 load_time_data.SetBoolean("showAppLauncherPromo", |
| 420 ShouldShowAppLauncherPromo()); | 419 ShouldShowAppLauncherPromo()); |
| 421 load_time_data.SetBoolean("showRecentlyClosed", | |
| 422 should_show_recently_closed_menu_); | |
| 423 load_time_data.SetString("title", | 420 load_time_data.SetString("title", |
| 424 l10n_util::GetStringUTF16(IDS_NEW_TAB_TITLE)); | 421 l10n_util::GetStringUTF16(IDS_NEW_TAB_TITLE)); |
| 425 load_time_data.SetString("mostvisited", | 422 load_time_data.SetString("mostvisited", |
| 426 l10n_util::GetStringUTF16(IDS_NEW_TAB_MOST_VISITED)); | 423 l10n_util::GetStringUTF16(IDS_NEW_TAB_MOST_VISITED)); |
| 427 load_time_data.SetString("suggestions", | 424 load_time_data.SetString("suggestions", |
| 428 l10n_util::GetStringUTF16(IDS_NEW_TAB_SUGGESTIONS)); | 425 l10n_util::GetStringUTF16(IDS_NEW_TAB_SUGGESTIONS)); |
| 429 load_time_data.SetString("restoreThumbnailsShort", | 426 load_time_data.SetString("restoreThumbnailsShort", |
| 430 l10n_util::GetStringUTF16(IDS_NEW_TAB_RESTORE_THUMBNAILS_SHORT_LINK)); | 427 l10n_util::GetStringUTF16(IDS_NEW_TAB_RESTORE_THUMBNAILS_SHORT_LINK)); |
| 431 load_time_data.SetString("recentlyclosed", | |
| 432 l10n_util::GetStringUTF16(IDS_NEW_TAB_RECENTLY_CLOSED)); | |
|
Dan Beam
2015/05/13 23:18:01
these are all still used from the flapjacks menu
Evan Stade
2015/05/14 00:09:45
should probably consider renaming them/reorganizin
Dan Beam
2015/05/14 01:09:34
they're all still valid ("1 tab", "## tabs" and "R
Evan Stade
2015/05/14 19:04:55
IDS_NEW_TAB_FOO is the conventional name of a stri
Dan Beam
2015/05/14 19:56:46
ah, the prefix. Done.
| |
| 433 load_time_data.SetString("webStoreTitle", | 428 load_time_data.SetString("webStoreTitle", |
| 434 l10n_util::GetStringUTF16(IDS_EXTENSION_WEB_STORE_TITLE)); | 429 l10n_util::GetStringUTF16(IDS_EXTENSION_WEB_STORE_TITLE)); |
| 435 load_time_data.SetString("webStoreTitleShort", | 430 load_time_data.SetString("webStoreTitleShort", |
| 436 l10n_util::GetStringUTF16(IDS_EXTENSION_WEB_STORE_TITLE_SHORT)); | 431 l10n_util::GetStringUTF16(IDS_EXTENSION_WEB_STORE_TITLE_SHORT)); |
| 437 load_time_data.SetString("closedwindowsingle", | |
| 438 l10n_util::GetStringUTF16(IDS_NEW_TAB_RECENTLY_CLOSED_WINDOW_SINGLE)); | |
| 439 load_time_data.SetString("closedwindowmultiple", | |
| 440 l10n_util::GetStringUTF16(IDS_NEW_TAB_RECENTLY_CLOSED_WINDOW_MULTIPLE)); | |
|
jungshik at Google
2015/05/14 08:02:04
IDS_NEW_TAB_RECENTLY_CLOSED_WINDOW_{SINGLE,MULTIPL
| |
| 441 load_time_data.SetString("attributionintro", | 432 load_time_data.SetString("attributionintro", |
| 442 l10n_util::GetStringUTF16(IDS_NEW_TAB_ATTRIBUTION_INTRO)); | 433 l10n_util::GetStringUTF16(IDS_NEW_TAB_ATTRIBUTION_INTRO)); |
| 443 load_time_data.SetString("thumbnailremovednotification", | 434 load_time_data.SetString("thumbnailremovednotification", |
| 444 l10n_util::GetStringUTF16(IDS_NEW_TAB_THUMBNAIL_REMOVED_NOTIFICATION)); | 435 l10n_util::GetStringUTF16(IDS_NEW_TAB_THUMBNAIL_REMOVED_NOTIFICATION)); |
| 445 load_time_data.SetString("undothumbnailremove", | 436 load_time_data.SetString("undothumbnailremove", |
| 446 l10n_util::GetStringUTF16(IDS_NEW_TAB_UNDO_THUMBNAIL_REMOVE)); | 437 l10n_util::GetStringUTF16(IDS_NEW_TAB_UNDO_THUMBNAIL_REMOVE)); |
| 447 load_time_data.SetString("removethumbnailtooltip", | 438 load_time_data.SetString("removethumbnailtooltip", |
| 448 l10n_util::GetStringUTF16(IDS_NEW_TAB_REMOVE_THUMBNAIL_TOOLTIP)); | 439 l10n_util::GetStringUTF16(IDS_NEW_TAB_REMOVE_THUMBNAIL_TOOLTIP)); |
| 449 load_time_data.SetString("appuninstall", | 440 load_time_data.SetString("appuninstall", |
| 450 l10n_util::GetStringUTF16(IDS_EXTENSIONS_UNINSTALL)); | 441 l10n_util::GetStringUTF16(IDS_EXTENSIONS_UNINSTALL)); |
| (...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 732 // Get our template. | 723 // Get our template. |
| 733 static const base::StringPiece new_tab_theme_css( | 724 static const base::StringPiece new_tab_theme_css( |
| 734 ResourceBundle::GetSharedInstance().GetRawDataResource( | 725 ResourceBundle::GetSharedInstance().GetRawDataResource( |
| 735 IDR_NEW_TAB_4_THEME_CSS)); | 726 IDR_NEW_TAB_4_THEME_CSS)); |
| 736 | 727 |
| 737 // Create the string from our template and the replacements. | 728 // Create the string from our template and the replacements. |
| 738 std::string css_string; | 729 std::string css_string; |
| 739 css_string = ReplaceStringPlaceholders(new_tab_theme_css, subst, NULL); | 730 css_string = ReplaceStringPlaceholders(new_tab_theme_css, subst, NULL); |
| 740 new_tab_css_ = base::RefCountedString::TakeString(&css_string); | 731 new_tab_css_ = base::RefCountedString::TakeString(&css_string); |
| 741 } | 732 } |
| OLD | NEW |