summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormirandac@chromium.org <mirandac@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-10-05 22:52:47 +0000
committermirandac@chromium.org <mirandac@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-10-05 22:52:47 +0000
commitfbef5d44a78f96fe1764852a907e096a18066724 (patch)
tree839d96e17f42b605385d83ea09eb818deadd532a
parenta01a805e84cdafc880c3cd82e5872e1d8a7cdba2 (diff)
downloadchromium_src-fbef5d44a78f96fe1764852a907e096a18066724.zip
chromium_src-fbef5d44a78f96fe1764852a907e096a18066724.tar.gz
chromium_src-fbef5d44a78f96fe1764852a907e096a18066724.tar.bz2
Make web resource service custom logo only redraw the new tab page cache, not the whole theme.
BUG=57187 TEST=no more crash on Linux. Review URL: http://codereview.chromium.org/3576014 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@61579 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/dom_ui/ntp_resource_cache.cc5
-rw-r--r--chrome/browser/web_resource/web_resource_service.cc10
-rw-r--r--chrome/common/notification_type.h4
3 files changed, 13 insertions, 6 deletions
diff --git a/chrome/browser/dom_ui/ntp_resource_cache.cc b/chrome/browser/dom_ui/ntp_resource_cache.cc
index 377d3eb..0cb0fd5 100644
--- a/chrome/browser/dom_ui/ntp_resource_cache.cc
+++ b/chrome/browser/dom_ui/ntp_resource_cache.cc
@@ -131,6 +131,8 @@ std::string GetNewTabBackgroundTilingCSS(const ThemeProvider* theme_provider) {
NTPResourceCache::NTPResourceCache(Profile* profile) : profile_(profile) {
registrar_.Add(this, NotificationType::BROWSER_THEME_CHANGED,
NotificationService::AllSources());
+ registrar_.Add(this, NotificationType::WEB_RESOURCE_AVAILABLE,
+ NotificationService::AllSources());
// Watch for pref changes that cause us to need to invalidate the HTML cache.
pref_change_registrar_.Init(profile_->GetPrefs());
@@ -167,7 +169,8 @@ RefCountedBytes* NTPResourceCache::GetNewTabCSS(bool is_off_the_record) {
void NTPResourceCache::Observe(NotificationType type,
const NotificationSource& source, const NotificationDetails& details) {
// Invalidate the cache.
- if (NotificationType::BROWSER_THEME_CHANGED == type) {
+ if (NotificationType::BROWSER_THEME_CHANGED == type ||
+ NotificationType::WEB_RESOURCE_AVAILABLE == type) {
new_tab_incognito_html_ = NULL;
new_tab_html_ = NULL;
new_tab_incognito_css_ = NULL;
diff --git a/chrome/browser/web_resource/web_resource_service.cc b/chrome/browser/web_resource/web_resource_service.cc
index 94c89d8..16e06dd 100644
--- a/chrome/browser/web_resource/web_resource_service.cc
+++ b/chrome/browser/web_resource/web_resource_service.cc
@@ -352,16 +352,16 @@ void WebResourceService::UnpackLogoSignal(const DictionaryValue& parsed_json) {
}
}
- // If logo start or end times have changed, trigger a theme change so that
- // the logo on the NTP is updated. This check is outside the reading of the
- // web resource data, because the absence of dates counts as a triggering
- // change if there were dates before.
+ // If logo start or end times have changed, trigger a new web resource
+ // notification, so that the logo on the NTP is updated. This check is
+ // outside the reading of the web resource data, because the absence of
+ // dates counts as a triggering change if there were dates before.
if (!(old_logo_start == logo_start) ||
!(old_logo_end == logo_end)) {
prefs_->SetReal(prefs::kNTPCustomLogoStart, logo_start);
prefs_->SetReal(prefs::kNTPCustomLogoEnd, logo_end);
NotificationService* service = NotificationService::current();
- service->Notify(NotificationType::BROWSER_THEME_CHANGED,
+ service->Notify(NotificationType::WEB_RESOURCE_AVAILABLE,
Source<WebResourceService>(this),
NotificationService::NoDetails());
}
diff --git a/chrome/common/notification_type.h b/chrome/common/notification_type.h
index 5febed7..33418cf 100644
--- a/chrome/common/notification_type.h
+++ b/chrome/common/notification_type.h
@@ -706,6 +706,10 @@ class NotificationType {
// should be the UI thread.
DEFAULT_REQUEST_CONTEXT_AVAILABLE,
+ // A new web resource has been made available. Source is the
+ // WebResourceService, and the details are NoDetails.
+ WEB_RESOURCE_AVAILABLE,
+
// Autocomplete ------------------------------------------------------------
// Sent by the autocomplete controller at least once per query, each time