Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(35)

Side by Side Diff: chrome/browser/ui/webui/ntp/ntp_resource_cache.cc

Issue 10584040: Merge 142914 - Remove NTP4 intro bubble (Closed) Base URL: svn://svn.chromium.org/chrome/branches/1180/src/
Patch Set: Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 <vector> 7 #include <vector>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/file_util.h" 10 #include "base/file_util.h"
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
179 179
180 } // namespace 180 } // namespace
181 181
182 NTPResourceCache::NTPResourceCache(Profile* profile) 182 NTPResourceCache::NTPResourceCache(Profile* profile)
183 : profile_(profile), is_swipe_tracking_from_scroll_events_enabled_(false) { 183 : profile_(profile), is_swipe_tracking_from_scroll_events_enabled_(false) {
184 registrar_.Add(this, chrome::NOTIFICATION_BROWSER_THEME_CHANGED, 184 registrar_.Add(this, chrome::NOTIFICATION_BROWSER_THEME_CHANGED,
185 content::Source<ThemeService>( 185 content::Source<ThemeService>(
186 ThemeServiceFactory::GetForProfile(profile))); 186 ThemeServiceFactory::GetForProfile(profile)));
187 registrar_.Add(this, chrome::NOTIFICATION_PROMO_RESOURCE_STATE_CHANGED, 187 registrar_.Add(this, chrome::NOTIFICATION_PROMO_RESOURCE_STATE_CHANGED,
188 content::NotificationService::AllSources()); 188 content::NotificationService::AllSources());
189 registrar_.Add(this, chrome::NTP4_INTRO_PREF_CHANGED,
190 content::NotificationService::AllSources());
191 189
192 // Watch for pref changes that cause us to need to invalidate the HTML cache. 190 // Watch for pref changes that cause us to need to invalidate the HTML cache.
193 pref_change_registrar_.Init(profile_->GetPrefs()); 191 pref_change_registrar_.Init(profile_->GetPrefs());
194 pref_change_registrar_.Add(prefs::kSyncAcknowledgedSyncTypes, this); 192 pref_change_registrar_.Add(prefs::kSyncAcknowledgedSyncTypes, this);
195 pref_change_registrar_.Add(prefs::kShowBookmarkBar, this); 193 pref_change_registrar_.Add(prefs::kShowBookmarkBar, this);
196 pref_change_registrar_.Add(prefs::kNtpShownPage, this); 194 pref_change_registrar_.Add(prefs::kNtpShownPage, this);
197 pref_change_registrar_.Add(prefs::kSyncPromoShowNTPBubble, this); 195 pref_change_registrar_.Add(prefs::kSyncPromoShowNTPBubble, this);
198 } 196 }
199 197
200 NTPResourceCache::~NTPResourceCache() {} 198 NTPResourceCache::~NTPResourceCache() {}
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 void NTPResourceCache::Observe(int type, 241 void NTPResourceCache::Observe(int type,
244 const content::NotificationSource& source, 242 const content::NotificationSource& source,
245 const content::NotificationDetails& details) { 243 const content::NotificationDetails& details) {
246 // Invalidate the cache. 244 // Invalidate the cache.
247 if (chrome::NOTIFICATION_BROWSER_THEME_CHANGED == type || 245 if (chrome::NOTIFICATION_BROWSER_THEME_CHANGED == type ||
248 chrome::NOTIFICATION_PROMO_RESOURCE_STATE_CHANGED == type) { 246 chrome::NOTIFICATION_PROMO_RESOURCE_STATE_CHANGED == type) {
249 new_tab_incognito_html_ = NULL; 247 new_tab_incognito_html_ = NULL;
250 new_tab_html_ = NULL; 248 new_tab_html_ = NULL;
251 new_tab_incognito_css_ = NULL; 249 new_tab_incognito_css_ = NULL;
252 new_tab_css_ = NULL; 250 new_tab_css_ = NULL;
253 } else if (chrome::NOTIFICATION_PREF_CHANGED == type || 251 } else if (chrome::NOTIFICATION_PREF_CHANGED == type) {
254 chrome::NTP4_INTRO_PREF_CHANGED == type) {
255 // A change occurred to one of the preferences we care about, so flush the 252 // A change occurred to one of the preferences we care about, so flush the
256 // cache. 253 // cache.
257 new_tab_incognito_html_ = NULL; 254 new_tab_incognito_html_ = NULL;
258 new_tab_html_ = NULL; 255 new_tab_html_ = NULL;
259 } else { 256 } else {
260 NOTREACHED(); 257 NOTREACHED();
261 } 258 }
262 } 259 }
263 260
264 void NTPResourceCache::CreateNewTabIncognitoHTML() { 261 void NTPResourceCache::CreateNewTabIncognitoHTML() {
(...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after
555 // Get our template. 552 // Get our template.
556 static const base::StringPiece new_tab_theme_css( 553 static const base::StringPiece new_tab_theme_css(
557 ResourceBundle::GetSharedInstance().GetRawDataResource( 554 ResourceBundle::GetSharedInstance().GetRawDataResource(
558 IDR_NEW_TAB_4_THEME_CSS, ui::SCALE_FACTOR_NONE)); 555 IDR_NEW_TAB_4_THEME_CSS, ui::SCALE_FACTOR_NONE));
559 556
560 // Create the string from our template and the replacements. 557 // Create the string from our template and the replacements.
561 std::string css_string; 558 std::string css_string;
562 css_string = ReplaceStringPlaceholders(new_tab_theme_css, subst, NULL); 559 css_string = ReplaceStringPlaceholders(new_tab_theme_css, subst, NULL);
563 new_tab_css_ = base::RefCountedString::TakeString(&css_string); 560 new_tab_css_ = base::RefCountedString::TakeString(&css_string);
564 } 561 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/ntp/new_tab_page_handler.cc ('k') | chrome/common/chrome_notification_types.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698