| 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 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 168 content::Source<ThemeService>( | 168 content::Source<ThemeService>( |
| 169 ThemeServiceFactory::GetForProfile(profile))); | 169 ThemeServiceFactory::GetForProfile(profile))); |
| 170 registrar_.Add(this, chrome::NOTIFICATION_PROMO_RESOURCE_STATE_CHANGED, | 170 registrar_.Add(this, chrome::NOTIFICATION_PROMO_RESOURCE_STATE_CHANGED, |
| 171 content::NotificationService::AllSources()); | 171 content::NotificationService::AllSources()); |
| 172 | 172 |
| 173 base::Closure callback = base::Bind(&NTPResourceCache::OnPreferenceChanged, | 173 base::Closure callback = base::Bind(&NTPResourceCache::OnPreferenceChanged, |
| 174 base::Unretained(this)); | 174 base::Unretained(this)); |
| 175 | 175 |
| 176 // Watch for pref changes that cause us to need to invalidate the HTML cache. | 176 // Watch for pref changes that cause us to need to invalidate the HTML cache. |
| 177 profile_pref_change_registrar_.Init(profile_->GetPrefs()); | 177 profile_pref_change_registrar_.Init(profile_->GetPrefs()); |
| 178 profile_pref_change_registrar_.Add(prefs::kSyncAcknowledgedSyncTypes, | |
| 179 callback); | |
| 180 profile_pref_change_registrar_.Add(prefs::kShowBookmarkBar, callback); | 178 profile_pref_change_registrar_.Add(prefs::kShowBookmarkBar, callback); |
| 181 profile_pref_change_registrar_.Add(prefs::kNtpShownPage, callback); | 179 profile_pref_change_registrar_.Add(prefs::kNtpShownPage, callback); |
| 182 profile_pref_change_registrar_.Add(prefs::kSignInPromoShowNTPBubble, | 180 profile_pref_change_registrar_.Add(prefs::kSignInPromoShowNTPBubble, |
| 183 callback); | 181 callback); |
| 184 profile_pref_change_registrar_.Add(prefs::kHideWebStoreIcon, callback); | 182 profile_pref_change_registrar_.Add(prefs::kHideWebStoreIcon, callback); |
| 185 | 183 |
| 186 // Some tests don't have a local state. | 184 // Some tests don't have a local state. |
| 187 #if defined(ENABLE_APP_LIST) | 185 #if defined(ENABLE_APP_LIST) |
| 188 if (g_browser_process->local_state()) { | 186 if (g_browser_process->local_state()) { |
| 189 local_state_pref_change_registrar_.Init(g_browser_process->local_state()); | 187 local_state_pref_change_registrar_.Init(g_browser_process->local_state()); |
| (...skipping 517 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 707 // Get our template. | 705 // Get our template. |
| 708 static const base::StringPiece new_tab_theme_css( | 706 static const base::StringPiece new_tab_theme_css( |
| 709 ResourceBundle::GetSharedInstance().GetRawDataResource( | 707 ResourceBundle::GetSharedInstance().GetRawDataResource( |
| 710 IDR_NEW_TAB_4_THEME_CSS)); | 708 IDR_NEW_TAB_4_THEME_CSS)); |
| 711 | 709 |
| 712 // Create the string from our template and the replacements. | 710 // Create the string from our template and the replacements. |
| 713 std::string css_string; | 711 std::string css_string; |
| 714 css_string = ReplaceStringPlaceholders(new_tab_theme_css, subst, NULL); | 712 css_string = ReplaceStringPlaceholders(new_tab_theme_css, subst, NULL); |
| 715 new_tab_css_ = base::RefCountedString::TakeString(&css_string); | 713 new_tab_css_ = base::RefCountedString::TakeString(&css_string); |
| 716 } | 714 } |
| OLD | NEW |