| OLD | NEW |
| 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 <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 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 ThemeServiceFactory::GetForProfile(profile))); | 174 ThemeServiceFactory::GetForProfile(profile))); |
| 175 registrar_.Add(this, chrome::NOTIFICATION_PROMO_RESOURCE_STATE_CHANGED, | 175 registrar_.Add(this, chrome::NOTIFICATION_PROMO_RESOURCE_STATE_CHANGED, |
| 176 content::NotificationService::AllSources()); | 176 content::NotificationService::AllSources()); |
| 177 registrar_.Add(this, chrome::NTP4_INTRO_PREF_CHANGED, | 177 registrar_.Add(this, chrome::NTP4_INTRO_PREF_CHANGED, |
| 178 content::NotificationService::AllSources()); | 178 content::NotificationService::AllSources()); |
| 179 | 179 |
| 180 // Watch for pref changes that cause us to need to invalidate the HTML cache. | 180 // Watch for pref changes that cause us to need to invalidate the HTML cache. |
| 181 pref_change_registrar_.Init(profile_->GetPrefs()); | 181 pref_change_registrar_.Init(profile_->GetPrefs()); |
| 182 pref_change_registrar_.Add(prefs::kSyncAcknowledgedSyncTypes, this); | 182 pref_change_registrar_.Add(prefs::kSyncAcknowledgedSyncTypes, this); |
| 183 pref_change_registrar_.Add(prefs::kShowBookmarkBar, this); | 183 pref_change_registrar_.Add(prefs::kShowBookmarkBar, this); |
| 184 pref_change_registrar_.Add(prefs::kHomePageIsNewTabPage, this); | |
| 185 pref_change_registrar_.Add(prefs::kNTPShownPage, this); | 184 pref_change_registrar_.Add(prefs::kNTPShownPage, this); |
| 186 pref_change_registrar_.Add(prefs::kSyncPromoShowNTPBubble, this); | 185 pref_change_registrar_.Add(prefs::kSyncPromoShowNTPBubble, this); |
| 187 } | 186 } |
| 188 | 187 |
| 189 NTPResourceCache::~NTPResourceCache() {} | 188 NTPResourceCache::~NTPResourceCache() {} |
| 190 | 189 |
| 191 RefCountedMemory* NTPResourceCache::GetNewTabHTML(bool is_incognito) { | 190 RefCountedMemory* NTPResourceCache::GetNewTabHTML(bool is_incognito) { |
| 192 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 191 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 193 if (is_incognito) { | 192 if (is_incognito) { |
| 194 if (!new_tab_incognito_html_.get()) | 193 if (!new_tab_incognito_html_.get()) |
| (...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 513 // Get our template. | 512 // Get our template. |
| 514 static const base::StringPiece new_tab_theme_css( | 513 static const base::StringPiece new_tab_theme_css( |
| 515 ResourceBundle::GetSharedInstance().GetRawDataResource( | 514 ResourceBundle::GetSharedInstance().GetRawDataResource( |
| 516 IDR_NEW_TAB_4_THEME_CSS)); | 515 IDR_NEW_TAB_4_THEME_CSS)); |
| 517 | 516 |
| 518 // Create the string from our template and the replacements. | 517 // Create the string from our template and the replacements. |
| 519 std::string css_string; | 518 std::string css_string; |
| 520 css_string = ReplaceStringPlaceholders(new_tab_theme_css, subst, NULL); | 519 css_string = ReplaceStringPlaceholders(new_tab_theme_css, subst, NULL); |
| 521 new_tab_css_ = base::RefCountedString::TakeString(&css_string); | 520 new_tab_css_ = base::RefCountedString::TakeString(&css_string); |
| 522 } | 521 } |
| OLD | NEW |