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 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 174 | 174 |
| 175 base::Closure callback = base::Bind(&NTPResourceCache::OnPreferenceChanged, | 175 base::Closure callback = base::Bind(&NTPResourceCache::OnPreferenceChanged, |
| 176 base::Unretained(this)); | 176 base::Unretained(this)); |
| 177 | 177 |
| 178 // Watch for pref changes that cause us to need to invalidate the HTML cache. | 178 // Watch for pref changes that cause us to need to invalidate the HTML cache. |
| 179 pref_change_registrar_.Init(profile_->GetPrefs()); | 179 pref_change_registrar_.Init(profile_->GetPrefs()); |
| 180 pref_change_registrar_.Add(prefs::kSyncAcknowledgedSyncTypes, callback); | 180 pref_change_registrar_.Add(prefs::kSyncAcknowledgedSyncTypes, callback); |
| 181 pref_change_registrar_.Add(prefs::kShowBookmarkBar, callback); | 181 pref_change_registrar_.Add(prefs::kShowBookmarkBar, callback); |
| 182 pref_change_registrar_.Add(prefs::kNtpShownPage, callback); | 182 pref_change_registrar_.Add(prefs::kNtpShownPage, callback); |
| 183 pref_change_registrar_.Add(prefs::kSyncPromoShowNTPBubble, callback); | 183 pref_change_registrar_.Add(prefs::kSyncPromoShowNTPBubble, callback); |
| 184 pref_change_registrar_.Add(prefs::kHideWebStoreIcon, callback); | |
| 184 } | 185 } |
| 185 | 186 |
| 186 NTPResourceCache::~NTPResourceCache() {} | 187 NTPResourceCache::~NTPResourceCache() {} |
| 187 | 188 |
| 188 bool NTPResourceCache::NewTabCacheNeedsRefresh() { | 189 bool NTPResourceCache::NewTabCacheNeedsRefresh() { |
| 189 #if defined(OS_MACOSX) | 190 #if defined(OS_MACOSX) |
| 190 // Invalidate if the current value is different from the cached value. | 191 // Invalidate if the current value is different from the cached value. |
| 191 bool is_enabled = platform_util::IsSwipeTrackingFromScrollEventsEnabled(); | 192 bool is_enabled = platform_util::IsSwipeTrackingFromScrollEventsEnabled(); |
| 192 if (is_enabled != is_swipe_tracking_from_scroll_events_enabled_) { | 193 if (is_enabled != is_swipe_tracking_from_scroll_events_enabled_) { |
| 193 is_swipe_tracking_from_scroll_events_enabled_ = is_enabled; | 194 is_swipe_tracking_from_scroll_events_enabled_ = is_enabled; |
| (...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 399 load_time_data.SetString("page_switcher_change_title", | 400 load_time_data.SetString("page_switcher_change_title", |
| 400 l10n_util::GetStringUTF16(IDS_NEW_TAB_PAGE_SWITCHER_CHANGE_TITLE)); | 401 l10n_util::GetStringUTF16(IDS_NEW_TAB_PAGE_SWITCHER_CHANGE_TITLE)); |
| 401 load_time_data.SetString("page_switcher_same_title", | 402 load_time_data.SetString("page_switcher_same_title", |
| 402 l10n_util::GetStringUTF16(IDS_NEW_TAB_PAGE_SWITCHER_SAME_TITLE)); | 403 l10n_util::GetStringUTF16(IDS_NEW_TAB_PAGE_SWITCHER_SAME_TITLE)); |
| 403 // On Mac OS X 10.7+, horizontal scrolling can be treated as a back or | 404 // On Mac OS X 10.7+, horizontal scrolling can be treated as a back or |
| 404 // forward gesture. Pass through a flag that indicates whether or not that | 405 // forward gesture. Pass through a flag that indicates whether or not that |
| 405 // feature is enabled. | 406 // feature is enabled. |
| 406 load_time_data.SetBoolean("isSwipeTrackingFromScrollEventsEnabled", | 407 load_time_data.SetBoolean("isSwipeTrackingFromScrollEventsEnabled", |
| 407 is_swipe_tracking_from_scroll_events_enabled_); | 408 is_swipe_tracking_from_scroll_events_enabled_); |
| 408 load_time_data.SetBoolean("showApps", should_show_apps_page_); | 409 load_time_data.SetBoolean("showApps", should_show_apps_page_); |
| 410 load_time_data.SetBoolean("isWebStoreIconHidden", | |
|
Evan Stade
2013/02/13 22:40:08
make this one's name match the above pref, i.e. s
dconnelly
2013/02/14 10:26:58
Done.
| |
| 411 prefs->GetBoolean(prefs::kHideWebStoreIcon)); | |
| 409 | 412 |
| 410 #if defined(OS_CHROMEOS) | 413 #if defined(OS_CHROMEOS) |
| 411 load_time_data.SetString("expandMenu", | 414 load_time_data.SetString("expandMenu", |
| 412 l10n_util::GetStringUTF16(IDS_NEW_TAB_CLOSE_MENU_EXPAND)); | 415 l10n_util::GetStringUTF16(IDS_NEW_TAB_CLOSE_MENU_EXPAND)); |
| 413 #endif | 416 #endif |
| 414 | 417 |
| 415 NewTabPageHandler::GetLocalizedValues(profile_, &load_time_data); | 418 NewTabPageHandler::GetLocalizedValues(profile_, &load_time_data); |
| 416 NTPLoginHandler::GetLocalizedValues(profile_, &load_time_data); | 419 NTPLoginHandler::GetLocalizedValues(profile_, &load_time_data); |
| 417 | 420 |
| 418 webui::SetFontAndTextDirection(&load_time_data); | 421 webui::SetFontAndTextDirection(&load_time_data); |
| (...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 586 static const base::StringPiece new_tab_theme_css( | 589 static const base::StringPiece new_tab_theme_css( |
| 587 ResourceBundle::GetSharedInstance().GetRawDataResource( | 590 ResourceBundle::GetSharedInstance().GetRawDataResource( |
| 588 chrome::search::IsInstantExtendedAPIEnabled(profile_) ? | 591 chrome::search::IsInstantExtendedAPIEnabled(profile_) ? |
| 589 IDR_NEW_TAB_SEARCH_THEME_CSS : IDR_NEW_TAB_4_THEME_CSS)); | 592 IDR_NEW_TAB_SEARCH_THEME_CSS : IDR_NEW_TAB_4_THEME_CSS)); |
| 590 | 593 |
| 591 // Create the string from our template and the replacements. | 594 // Create the string from our template and the replacements. |
| 592 std::string css_string; | 595 std::string css_string; |
| 593 css_string = ReplaceStringPlaceholders(new_tab_theme_css, subst, NULL); | 596 css_string = ReplaceStringPlaceholders(new_tab_theme_css, subst, NULL); |
| 594 new_tab_css_ = base::RefCountedString::TakeString(&css_string); | 597 new_tab_css_ = base::RefCountedString::TakeString(&css_string); |
| 595 } | 598 } |
| OLD | NEW |