Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1778)

Unified Diff: chrome/browser/dom_ui/new_tab_ui.cc

Issue 243067: Fix NTP so that it updates on theme change.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/dom_ui/new_tab_ui.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/dom_ui/new_tab_ui.cc
===================================================================
--- chrome/browser/dom_ui/new_tab_ui.cc (revision 27540)
+++ chrome/browser/dom_ui/new_tab_ui.cc (working copy)
@@ -1680,11 +1680,7 @@
// 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,
@@ -1708,6 +1704,7 @@
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))
@@ -1717,6 +1714,16 @@
}
}
+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);
« no previous file with comments | « chrome/browser/dom_ui/new_tab_ui.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698