| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/dom_ui/ntp_resource_cache.h" | 5 #include "chrome/browser/dom_ui/ntp_resource_cache.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "app/animation.h" | 10 #include "app/animation.h" |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 NotificationService::AllSources()); | 133 NotificationService::AllSources()); |
| 134 registrar_.Add(this, NotificationType::WEB_RESOURCE_AVAILABLE, | 134 registrar_.Add(this, NotificationType::WEB_RESOURCE_AVAILABLE, |
| 135 NotificationService::AllSources()); | 135 NotificationService::AllSources()); |
| 136 | 136 |
| 137 // Watch for pref changes that cause us to need to invalidate the HTML cache. | 137 // Watch for pref changes that cause us to need to invalidate the HTML cache. |
| 138 pref_change_registrar_.Init(profile_->GetPrefs()); | 138 pref_change_registrar_.Init(profile_->GetPrefs()); |
| 139 pref_change_registrar_.Add(prefs::kShowBookmarkBar, this); | 139 pref_change_registrar_.Add(prefs::kShowBookmarkBar, this); |
| 140 pref_change_registrar_.Add(prefs::kNTPShownSections, this); | 140 pref_change_registrar_.Add(prefs::kNTPShownSections, this); |
| 141 } | 141 } |
| 142 | 142 |
| 143 NTPResourceCache::~NTPResourceCache() {} |
| 144 |
| 143 RefCountedBytes* NTPResourceCache::GetNewTabHTML(bool is_off_the_record) { | 145 RefCountedBytes* NTPResourceCache::GetNewTabHTML(bool is_off_the_record) { |
| 144 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 146 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 145 if (is_off_the_record) { | 147 if (is_off_the_record) { |
| 146 if (!new_tab_incognito_html_.get()) | 148 if (!new_tab_incognito_html_.get()) |
| 147 CreateNewTabIncognitoHTML(); | 149 CreateNewTabIncognitoHTML(); |
| 148 } else { | 150 } else { |
| 149 if (!new_tab_html_.get()) | 151 if (!new_tab_html_.get()) |
| 150 CreateNewTabHTML(); | 152 CreateNewTabHTML(); |
| 151 } | 153 } |
| 152 return is_off_the_record ? new_tab_incognito_html_.get() | 154 return is_off_the_record ? new_tab_incognito_html_.get() |
| (...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 499 std::string css_string; | 501 std::string css_string; |
| 500 css_string = ReplaceStringPlaceholders(new_tab_theme_css, subst, NULL); | 502 css_string = ReplaceStringPlaceholders(new_tab_theme_css, subst, NULL); |
| 501 css_string = ReplaceStringPlaceholders(css_string, subst2, NULL); | 503 css_string = ReplaceStringPlaceholders(css_string, subst2, NULL); |
| 502 css_string = ReplaceStringPlaceholders(css_string, subst3, NULL); | 504 css_string = ReplaceStringPlaceholders(css_string, subst3, NULL); |
| 503 | 505 |
| 504 new_tab_css_ = new RefCountedBytes; | 506 new_tab_css_ = new RefCountedBytes; |
| 505 new_tab_css_->data.resize(css_string.size()); | 507 new_tab_css_->data.resize(css_string.size()); |
| 506 std::copy(css_string.begin(), css_string.end(), | 508 std::copy(css_string.begin(), css_string.end(), |
| 507 new_tab_css_->data.begin()); | 509 new_tab_css_->data.begin()); |
| 508 } | 510 } |
| OLD | NEW |