summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-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