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

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

Issue 9861016: [NTP4] Fix theme and bookmarks bar notifications. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 8 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 187 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 198
199 RefCountedMemory* NTPResourceCache::GetNewTabHTML(bool is_incognito) { 199 RefCountedMemory* NTPResourceCache::GetNewTabHTML(bool is_incognito) {
200 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 200 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
201 if (is_incognito) { 201 if (is_incognito) {
202 if (!new_tab_incognito_html_.get()) 202 if (!new_tab_incognito_html_.get())
203 CreateNewTabIncognitoHTML(); 203 CreateNewTabIncognitoHTML();
204 } else { 204 } else {
205 if (!new_tab_html_.get()) 205 if (!new_tab_html_.get())
206 CreateNewTabHTML(); 206 CreateNewTabHTML();
207 } 207 }
208 return is_incognito ? new_tab_incognito_html_.get() 208 return is_incognito ? new_tab_incognito_html_.get() :
Dan Beam 2012/03/27 10:30:13 tell me if this is not right thing to do or if you
209 : new_tab_html_.get(); 209 new_tab_html_.get();
210 } 210 }
211 211
212 RefCountedMemory* NTPResourceCache::GetNewTabCSS(bool is_incognito) { 212 RefCountedMemory* NTPResourceCache::GetNewTabCSS(bool is_incognito) {
213 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 213 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
214 if (is_incognito) { 214 if (is_incognito) {
215 if (!new_tab_incognito_css_.get()) 215 if (!new_tab_incognito_css_.get())
216 CreateNewTabIncognitoCSS(); 216 CreateNewTabIncognitoCSS();
217 } else { 217 } else {
218 if (!new_tab_css_.get()) 218 if (!new_tab_css_.get())
219 CreateNewTabCSS(); 219 CreateNewTabCSS();
220 } 220 }
221 return is_incognito ? new_tab_incognito_css_.get() 221 return is_incognito ? new_tab_incognito_css_.get() :
222 : new_tab_css_.get(); 222 new_tab_css_.get();
223 } 223 }
224 224
225 void NTPResourceCache::Observe(int type, 225 void NTPResourceCache::Observe(int type,
226 const content::NotificationSource& source, 226 const content::NotificationSource& source,
227 const content::NotificationDetails& details) { 227 const content::NotificationDetails& details) {
228 // Invalidate the cache. 228 // Invalidate the cache.
229 if (chrome::NOTIFICATION_BROWSER_THEME_CHANGED == type || 229 if (chrome::NOTIFICATION_BROWSER_THEME_CHANGED == type ||
230 chrome::NOTIFICATION_PROMO_RESOURCE_STATE_CHANGED == type) { 230 chrome::NOTIFICATION_PROMO_RESOURCE_STATE_CHANGED == type) {
231 new_tab_incognito_html_ = NULL; 231 new_tab_incognito_html_ = NULL;
232 new_tab_html_ = NULL; 232 new_tab_html_ = NULL;
(...skipping 309 matching lines...) Expand 10 before | Expand all | Expand 10 after
542 // Get our template. 542 // Get our template.
543 static const base::StringPiece new_tab_theme_css( 543 static const base::StringPiece new_tab_theme_css(
544 ResourceBundle::GetSharedInstance().GetRawDataResource( 544 ResourceBundle::GetSharedInstance().GetRawDataResource(
545 IDR_NEW_TAB_4_THEME_CSS)); 545 IDR_NEW_TAB_4_THEME_CSS));
546 546
547 // Create the string from our template and the replacements. 547 // Create the string from our template and the replacements.
548 std::string css_string; 548 std::string css_string;
549 css_string = ReplaceStringPlaceholders(new_tab_theme_css, subst, NULL); 549 css_string = ReplaceStringPlaceholders(new_tab_theme_css, subst, NULL);
550 new_tab_css_ = base::RefCountedString::TakeString(&css_string); 550 new_tab_css_ = base::RefCountedString::TakeString(&css_string);
551 } 551 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698