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 <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 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
175 NotificationService::AllSources()); | 175 NotificationService::AllSources()); |
176 | 176 |
177 // Watch for pref changes that cause us to need to invalidate the HTML cache. | 177 // Watch for pref changes that cause us to need to invalidate the HTML cache. |
178 pref_change_registrar_.Init(profile_->GetPrefs()); | 178 pref_change_registrar_.Init(profile_->GetPrefs()); |
179 pref_change_registrar_.Add(prefs::kAcknowledgedSyncTypes, this); | 179 pref_change_registrar_.Add(prefs::kAcknowledgedSyncTypes, this); |
180 pref_change_registrar_.Add(prefs::kShowBookmarkBar, this); | 180 pref_change_registrar_.Add(prefs::kShowBookmarkBar, this); |
181 pref_change_registrar_.Add(prefs::kEnableBookmarkBar, this); | 181 pref_change_registrar_.Add(prefs::kEnableBookmarkBar, this); |
182 pref_change_registrar_.Add(prefs::kHomePageIsNewTabPage, this); | 182 pref_change_registrar_.Add(prefs::kHomePageIsNewTabPage, this); |
183 pref_change_registrar_.Add(prefs::kNTPShownSections, this); | 183 pref_change_registrar_.Add(prefs::kNTPShownSections, this); |
184 pref_change_registrar_.Add(prefs::kNTPShownPage, this); | 184 pref_change_registrar_.Add(prefs::kNTPShownPage, this); |
| 185 pref_change_registrar_.Add(prefs::kNTP4IntroDisplayCount, this); |
185 } | 186 } |
186 | 187 |
187 NTPResourceCache::~NTPResourceCache() {} | 188 NTPResourceCache::~NTPResourceCache() {} |
188 | 189 |
189 RefCountedMemory* NTPResourceCache::GetNewTabHTML(bool is_incognito) { | 190 RefCountedMemory* NTPResourceCache::GetNewTabHTML(bool is_incognito) { |
190 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 191 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
191 if (is_incognito) { | 192 if (is_incognito) { |
192 if (!new_tab_incognito_html_.get()) | 193 if (!new_tab_incognito_html_.get()) |
193 CreateNewTabIncognitoHTML(); | 194 CreateNewTabIncognitoHTML(); |
194 } else { | 195 } else { |
(...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
604 IDR_NEW_TAB_4_THEME_CSS : IDR_NEW_TAB_THEME_CSS; | 605 IDR_NEW_TAB_4_THEME_CSS : IDR_NEW_TAB_THEME_CSS; |
605 static const base::StringPiece new_tab_theme_css( | 606 static const base::StringPiece new_tab_theme_css( |
606 ResourceBundle::GetSharedInstance().GetRawDataResource( | 607 ResourceBundle::GetSharedInstance().GetRawDataResource( |
607 ntp_css_resource_id)); | 608 ntp_css_resource_id)); |
608 | 609 |
609 // Create the string from our template and the replacements. | 610 // Create the string from our template and the replacements. |
610 std::string css_string; | 611 std::string css_string; |
611 css_string = ReplaceStringPlaceholders(new_tab_theme_css, subst, NULL); | 612 css_string = ReplaceStringPlaceholders(new_tab_theme_css, subst, NULL); |
612 new_tab_css_ = base::RefCountedString::TakeString(&css_string); | 613 new_tab_css_ = base::RefCountedString::TakeString(&css_string); |
613 } | 614 } |
OLD | NEW |