summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormirandac@chromium.org <mirandac@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-02 15:14:29 +0000
committermirandac@chromium.org <mirandac@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-02 15:14:29 +0000
commitadde09f4c0b310e51be2424cff14f37c352e4a59 (patch)
tree3cfc0ec4d046ebbe6c0250e87d6ff245f1ff7315
parent70a4b214d0967cccfecc57222c987290556e8e2c (diff)
downloadchromium_src-adde09f4c0b310e51be2424cff14f37c352e4a59.zip
chromium_src-adde09f4c0b310e51be2424cff14f37c352e4a59.tar.gz
chromium_src-adde09f4c0b310e51be2424cff14f37c352e4a59.tar.bz2
Fix NTP so that it updates on theme change.
BUG= http://crbug.com/20392 TEST= Open several windows and new tabs. Change theme. Note that NTP background images all update correctly. Review URL: http://codereview.chromium.org/243067 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@27841 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/dom_ui/new_tab_ui.cc17
-rw-r--r--chrome/browser/dom_ui/new_tab_ui.h3
2 files changed, 15 insertions, 5 deletions
diff --git a/chrome/browser/dom_ui/new_tab_ui.cc b/chrome/browser/dom_ui/new_tab_ui.cc
index e035bc9..86ebb60 100644
--- a/chrome/browser/dom_ui/new_tab_ui.cc
+++ b/chrome/browser/dom_ui/new_tab_ui.cc
@@ -1679,11 +1679,7 @@ NewTabUI::NewTabUI(TabContents* contents)
// In testing mode there may not be an I/O thread.
if (g_browser_process->io_thread()) {
- g_browser_process->io_thread()->message_loop()->PostTask(FROM_HERE,
- NewRunnableMethod(&chrome_url_data_manager,
- &ChromeURLDataManager::AddDataSource,
- new DOMUIThemeSource(GetProfile())));
-
+ InitializeCSSCaches();
NewTabHTMLSource* html_source = new NewTabHTMLSource(GetProfile());
g_browser_process->io_thread()->message_loop()->PostTask(FROM_HERE,
NewRunnableMethod(&chrome_url_data_manager,
@@ -1707,6 +1703,7 @@ void NewTabUI::Observe(NotificationType type,
const NotificationSource& source,
const NotificationDetails& details) {
if (NotificationType::BROWSER_THEME_CHANGED == type) {
+ InitializeCSSCaches();
CallJavascriptFunction(L"themeChanged");
} else if (NotificationType::BOOKMARK_BAR_VISIBILITY_PREF_CHANGED) {
if (GetProfile()->GetPrefs()->GetBoolean(prefs::kShowBookmarkBar))
@@ -1716,6 +1713,16 @@ void NewTabUI::Observe(NotificationType type,
}
}
+void NewTabUI::InitializeCSSCaches() {
+ // In testing mode there may not be an I/O thread.
+ if (g_browser_process->io_thread()) {
+ g_browser_process->io_thread()->message_loop()->PostTask(FROM_HERE,
+ NewRunnableMethod(&chrome_url_data_manager,
+ &ChromeURLDataManager::AddDataSource,
+ new DOMUIThemeSource(GetProfile())));
+ }
+}
+
// static
void NewTabUI::RegisterUserPrefs(PrefService* prefs) {
MostVisitedHandler::RegisterUserPrefs(prefs);
diff --git a/chrome/browser/dom_ui/new_tab_ui.h b/chrome/browser/dom_ui/new_tab_ui.h
index 07f27ca..bc60804 100644
--- a/chrome/browser/dom_ui/new_tab_ui.h
+++ b/chrome/browser/dom_ui/new_tab_ui.h
@@ -40,6 +40,9 @@ private:
const NotificationSource& source,
const NotificationDetails& details);
+ // Reset the CSS caches.
+ void InitializeCSSCaches();
+
NotificationRegistrar registrar_;
// The message id that should be displayed in this NewTabUIContents