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 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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); | 184 pref_change_registrar_.Add(prefs::kHomePageIsNewTabPage, this); |
185 pref_change_registrar_.Add(prefs::kNTPShownPage, this); | 185 pref_change_registrar_.Add(prefs::kNTPShownPage, this); |
| 186 pref_change_registrar_.Add(prefs::kSyncPromoShowNTPBubble, this); |
186 } | 187 } |
187 | 188 |
188 NTPResourceCache::~NTPResourceCache() {} | 189 NTPResourceCache::~NTPResourceCache() {} |
189 | 190 |
190 RefCountedMemory* NTPResourceCache::GetNewTabHTML(bool is_incognito) { | 191 RefCountedMemory* NTPResourceCache::GetNewTabHTML(bool is_incognito) { |
191 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 192 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
192 if (is_incognito) { | 193 if (is_incognito) { |
193 if (!new_tab_incognito_html_.get()) | 194 if (!new_tab_incognito_html_.get()) |
194 CreateNewTabIncognitoHTML(); | 195 CreateNewTabIncognitoHTML(); |
195 } else { | 196 } else { |
(...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
583 IDR_NEW_TAB_4_THEME_CSS : IDR_NEW_TAB_THEME_CSS; | 584 IDR_NEW_TAB_4_THEME_CSS : IDR_NEW_TAB_THEME_CSS; |
584 static const base::StringPiece new_tab_theme_css( | 585 static const base::StringPiece new_tab_theme_css( |
585 ResourceBundle::GetSharedInstance().GetRawDataResource( | 586 ResourceBundle::GetSharedInstance().GetRawDataResource( |
586 ntp_css_resource_id)); | 587 ntp_css_resource_id)); |
587 | 588 |
588 // Create the string from our template and the replacements. | 589 // Create the string from our template and the replacements. |
589 std::string css_string; | 590 std::string css_string; |
590 css_string = ReplaceStringPlaceholders(new_tab_theme_css, subst, NULL); | 591 css_string = ReplaceStringPlaceholders(new_tab_theme_css, subst, NULL); |
591 new_tab_css_ = base::RefCountedString::TakeString(&css_string); | 592 new_tab_css_ = base::RefCountedString::TakeString(&css_string); |
592 } | 593 } |
OLD | NEW |