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

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

Issue 7461160: ntp4 info bubble (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: even more docs Created 9 years, 4 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 <algorithm> 7 #include <algorithm>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 ThemeServiceFactory::GetForProfile(profile))); 172 ThemeServiceFactory::GetForProfile(profile)));
173 registrar_.Add(this, chrome::NOTIFICATION_PROMO_RESOURCE_STATE_CHANGED, 173 registrar_.Add(this, chrome::NOTIFICATION_PROMO_RESOURCE_STATE_CHANGED,
174 NotificationService::AllSources()); 174 NotificationService::AllSources());
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 pref_change_registrar_.Init(profile_->GetPrefs()); 177 pref_change_registrar_.Init(profile_->GetPrefs());
178 pref_change_registrar_.Add(prefs::kShowBookmarkBar, this); 178 pref_change_registrar_.Add(prefs::kShowBookmarkBar, this);
179 pref_change_registrar_.Add(prefs::kEnableBookmarkBar, this); 179 pref_change_registrar_.Add(prefs::kEnableBookmarkBar, this);
180 pref_change_registrar_.Add(prefs::kNTPShownSections, this); 180 pref_change_registrar_.Add(prefs::kNTPShownSections, this);
181 pref_change_registrar_.Add(prefs::kNTPShownPage, this); 181 pref_change_registrar_.Add(prefs::kNTPShownPage, this);
182 pref_change_registrar_.Add(prefs::kNTP4IntroDisplayCount, this);
182 } 183 }
183 184
184 NTPResourceCache::~NTPResourceCache() {} 185 NTPResourceCache::~NTPResourceCache() {}
185 186
186 RefCountedMemory* NTPResourceCache::GetNewTabHTML(bool is_incognito) { 187 RefCountedMemory* NTPResourceCache::GetNewTabHTML(bool is_incognito) {
187 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 188 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
188 if (is_incognito) { 189 if (is_incognito) {
189 if (!new_tab_incognito_html_.get()) 190 if (!new_tab_incognito_html_.get())
190 CreateNewTabIncognitoHTML(); 191 CreateNewTabIncognitoHTML();
191 } else { 192 } else {
(...skipping 25 matching lines...) Expand all
217 new_tab_incognito_html_ = NULL; 218 new_tab_incognito_html_ = NULL;
218 new_tab_html_ = NULL; 219 new_tab_html_ = NULL;
219 new_tab_incognito_css_ = NULL; 220 new_tab_incognito_css_ = NULL;
220 new_tab_css_ = NULL; 221 new_tab_css_ = NULL;
221 } else if (chrome::NOTIFICATION_PREF_CHANGED == type) { 222 } else if (chrome::NOTIFICATION_PREF_CHANGED == type) {
222 std::string* pref_name = Details<std::string>(details).ptr(); 223 std::string* pref_name = Details<std::string>(details).ptr();
223 if (*pref_name == prefs::kShowBookmarkBar || 224 if (*pref_name == prefs::kShowBookmarkBar ||
224 *pref_name == prefs::kEnableBookmarkBar || 225 *pref_name == prefs::kEnableBookmarkBar ||
225 *pref_name == prefs::kHomePageIsNewTabPage || 226 *pref_name == prefs::kHomePageIsNewTabPage ||
226 *pref_name == prefs::kNTPShownSections || 227 *pref_name == prefs::kNTPShownSections ||
227 *pref_name == prefs::kNTPShownPage) { 228 *pref_name == prefs::kNTPShownPage ||
229 *pref_name == prefs::kNTP4IntroDisplayCount) {
228 new_tab_incognito_html_ = NULL; 230 new_tab_incognito_html_ = NULL;
229 new_tab_html_ = NULL; 231 new_tab_html_ = NULL;
230 } else { 232 } else {
231 NOTREACHED(); 233 NOTREACHED();
232 } 234 }
233 } else { 235 } else {
234 NOTREACHED(); 236 NOTREACHED();
235 } 237 }
236 } 238 }
237 239
(...skipping 337 matching lines...) Expand 10 before | Expand all | Expand 10 after
575 IDR_NEW_TAB_4_THEME_CSS : IDR_NEW_TAB_THEME_CSS; 577 IDR_NEW_TAB_4_THEME_CSS : IDR_NEW_TAB_THEME_CSS;
576 static const base::StringPiece new_tab_theme_css( 578 static const base::StringPiece new_tab_theme_css(
577 ResourceBundle::GetSharedInstance().GetRawDataResource( 579 ResourceBundle::GetSharedInstance().GetRawDataResource(
578 ntp_css_resource_id)); 580 ntp_css_resource_id));
579 581
580 // Create the string from our template and the replacements. 582 // Create the string from our template and the replacements.
581 std::string css_string; 583 std::string css_string;
582 css_string = ReplaceStringPlaceholders(new_tab_theme_css, subst, NULL); 584 css_string = ReplaceStringPlaceholders(new_tab_theme_css, subst, NULL);
583 new_tab_css_ = base::RefCountedString::TakeString(&css_string); 585 new_tab_css_ = base::RefCountedString::TakeString(&css_string);
584 } 586 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698