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 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 int repeat_mode = theme_provider->GetDisplayProperty( | 158 int repeat_mode = theme_provider->GetDisplayProperty( |
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), | |
169 should_show_other_devices_menu_(true) { | 168 should_show_other_devices_menu_(true) { |
170 registrar_.Add(this, chrome::NOTIFICATION_BROWSER_THEME_CHANGED, | 169 registrar_.Add(this, chrome::NOTIFICATION_BROWSER_THEME_CHANGED, |
171 content::Source<ThemeService>( | 170 content::Source<ThemeService>( |
172 ThemeServiceFactory::GetForProfile(profile))); | 171 ThemeServiceFactory::GetForProfile(profile))); |
173 registrar_.Add(this, chrome::NOTIFICATION_PROMO_RESOURCE_STATE_CHANGED, | 172 registrar_.Add(this, chrome::NOTIFICATION_PROMO_RESOURCE_STATE_CHANGED, |
174 content::NotificationService::AllSources()); | 173 content::NotificationService::AllSources()); |
175 | 174 |
176 PromoResourceService* promo_service = | 175 PromoResourceService* promo_service = |
177 g_browser_process->promo_resource_service(); | 176 g_browser_process->promo_resource_service(); |
178 if (promo_service) { | 177 if (promo_service) { |
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
407 // (in GetLocalizedValues) and should have more legible names. | 406 // (in GetLocalizedValues) and should have more legible names. |
408 // Show the profile name in the title and most visited labels if the current | 407 // Show the profile name in the title and most visited labels if the current |
409 // profile is not the default. | 408 // profile is not the default. |
410 PrefService* prefs = profile_->GetPrefs(); | 409 PrefService* prefs = profile_->GetPrefs(); |
411 base::DictionaryValue load_time_data; | 410 base::DictionaryValue load_time_data; |
412 load_time_data.SetBoolean("bookmarkbarattached", | 411 load_time_data.SetBoolean("bookmarkbarattached", |
413 prefs->GetBoolean(bookmarks::prefs::kShowBookmarkBar)); | 412 prefs->GetBoolean(bookmarks::prefs::kShowBookmarkBar)); |
414 load_time_data.SetBoolean("hasattribution", | 413 load_time_data.SetBoolean("hasattribution", |
415 ThemeServiceFactory::GetForProfile(profile_)->HasCustomImage( | 414 ThemeServiceFactory::GetForProfile(profile_)->HasCustomImage( |
416 IDR_THEME_NTP_ATTRIBUTION)); | 415 IDR_THEME_NTP_ATTRIBUTION)); |
417 load_time_data.SetBoolean("showMostvisited", should_show_most_visited_page_); | |
418 load_time_data.SetBoolean("showAppLauncherPromo", | 416 load_time_data.SetBoolean("showAppLauncherPromo", |
419 ShouldShowAppLauncherPromo()); | 417 ShouldShowAppLauncherPromo()); |
420 load_time_data.SetString("title", | 418 load_time_data.SetString("title", |
421 l10n_util::GetStringUTF16(IDS_NEW_TAB_TITLE)); | 419 l10n_util::GetStringUTF16(IDS_NEW_TAB_TITLE)); |
422 load_time_data.SetString("mostvisited", | |
423 l10n_util::GetStringUTF16(IDS_NEW_TAB_MOST_VISITED)); | |
424 load_time_data.SetString("restoreThumbnailsShort", | |
425 l10n_util::GetStringUTF16(IDS_NEW_TAB_RESTORE_THUMBNAILS_SHORT_LINK)); | |
426 load_time_data.SetString("webStoreTitle", | 420 load_time_data.SetString("webStoreTitle", |
427 l10n_util::GetStringUTF16(IDS_EXTENSION_WEB_STORE_TITLE)); | 421 l10n_util::GetStringUTF16(IDS_EXTENSION_WEB_STORE_TITLE)); |
428 load_time_data.SetString("webStoreTitleShort", | 422 load_time_data.SetString("webStoreTitleShort", |
429 l10n_util::GetStringUTF16(IDS_EXTENSION_WEB_STORE_TITLE_SHORT)); | 423 l10n_util::GetStringUTF16(IDS_EXTENSION_WEB_STORE_TITLE_SHORT)); |
430 load_time_data.SetString("attributionintro", | 424 load_time_data.SetString("attributionintro", |
431 l10n_util::GetStringUTF16(IDS_NEW_TAB_ATTRIBUTION_INTRO)); | 425 l10n_util::GetStringUTF16(IDS_NEW_TAB_ATTRIBUTION_INTRO)); |
432 load_time_data.SetString("thumbnailremovednotification", | |
433 l10n_util::GetStringUTF16(IDS_NEW_TAB_THUMBNAIL_REMOVED_NOTIFICATION)); | |
434 load_time_data.SetString("undothumbnailremove", | |
435 l10n_util::GetStringUTF16(IDS_NEW_TAB_UNDO_THUMBNAIL_REMOVE)); | |
436 load_time_data.SetString("removethumbnailtooltip", | |
437 l10n_util::GetStringUTF16(IDS_NEW_TAB_REMOVE_THUMBNAIL_TOOLTIP)); | |
438 load_time_data.SetString("appuninstall", | 426 load_time_data.SetString("appuninstall", |
439 l10n_util::GetStringUTF16(IDS_EXTENSIONS_UNINSTALL)); | 427 l10n_util::GetStringUTF16(IDS_EXTENSIONS_UNINSTALL)); |
440 load_time_data.SetString("appoptions", | 428 load_time_data.SetString("appoptions", |
441 l10n_util::GetStringUTF16(IDS_NEW_TAB_APP_OPTIONS)); | 429 l10n_util::GetStringUTF16(IDS_NEW_TAB_APP_OPTIONS)); |
442 load_time_data.SetString("appdetails", | 430 load_time_data.SetString("appdetails", |
443 l10n_util::GetStringUTF16(IDS_NEW_TAB_APP_DETAILS)); | 431 l10n_util::GetStringUTF16(IDS_NEW_TAB_APP_DETAILS)); |
444 load_time_data.SetString("appinfodialog", | 432 load_time_data.SetString("appinfodialog", |
445 l10n_util::GetStringUTF16(IDS_APP_CONTEXT_MENU_SHOW_INFO)); | 433 l10n_util::GetStringUTF16(IDS_APP_CONTEXT_MENU_SHOW_INFO)); |
446 load_time_data.SetString("appcreateshortcut", | 434 load_time_data.SetString("appcreateshortcut", |
447 l10n_util::GetStringUTF16(IDS_NEW_TAB_APP_CREATE_SHORTCUT)); | 435 l10n_util::GetStringUTF16(IDS_NEW_TAB_APP_CREATE_SHORTCUT)); |
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
701 // Get our template. | 689 // Get our template. |
702 static const base::StringPiece new_tab_theme_css( | 690 static const base::StringPiece new_tab_theme_css( |
703 ResourceBundle::GetSharedInstance().GetRawDataResource( | 691 ResourceBundle::GetSharedInstance().GetRawDataResource( |
704 IDR_NEW_TAB_4_THEME_CSS)); | 692 IDR_NEW_TAB_4_THEME_CSS)); |
705 | 693 |
706 // Create the string from our template and the replacements. | 694 // Create the string from our template and the replacements. |
707 std::string css_string; | 695 std::string css_string; |
708 css_string = ReplaceStringPlaceholders(new_tab_theme_css, subst, NULL); | 696 css_string = ReplaceStringPlaceholders(new_tab_theme_css, subst, NULL); |
709 new_tab_css_ = base::RefCountedString::TakeString(&css_string); | 697 new_tab_css_ = base::RefCountedString::TakeString(&css_string); |
710 } | 698 } |
OLD | NEW |