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

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

Issue 42512: Make the bookmarks bar disappear when the load after the new tab page commits... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 9 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
Index: chrome/browser/dom_ui/new_tab_ui.cc
===================================================================
--- chrome/browser/dom_ui/new_tab_ui.cc (revision 12396)
+++ chrome/browser/dom_ui/new_tab_ui.cc (working copy)
@@ -382,16 +382,19 @@
dom_ui_->RegisterMessageCallback("getMostVisited",
NewCallback(this, &MostVisitedHandler::HandleGetMostVisited));
- // Set up our sources for thumbnail and favicon data.
- // Ownership is passed to the ChromeURLDataManager.
- g_browser_process->io_thread()->message_loop()->PostTask(FROM_HERE,
- NewRunnableMethod(&chrome_url_data_manager,
- &ChromeURLDataManager::AddDataSource,
- new DOMUIThumbnailSource(dom_ui->GetProfile())));
- g_browser_process->io_thread()->message_loop()->PostTask(FROM_HERE,
- NewRunnableMethod(&chrome_url_data_manager,
- &ChromeURLDataManager::AddDataSource,
- new DOMUIFavIconSource(dom_ui->GetProfile())));
+ // Set up our sources for thumbnail and favicon data. Since we may be in
+ // testing mode with no I/O thread, only add our handler when an I/O thread
+ // exists. Ownership is passed to the ChromeURLDataManager.
+ if (g_browser_process->io_thread()) {
+ g_browser_process->io_thread()->message_loop()->PostTask(FROM_HERE,
+ NewRunnableMethod(&chrome_url_data_manager,
+ &ChromeURLDataManager::AddDataSource,
+ new DOMUIThumbnailSource(dom_ui->GetProfile())));
+ g_browser_process->io_thread()->message_loop()->PostTask(FROM_HERE,
+ NewRunnableMethod(&chrome_url_data_manager,
+ &ChromeURLDataManager::AddDataSource,
+ new DOMUIFavIconSource(dom_ui->GetProfile())));
+ }
// Get notifications when history is cleared.
NotificationService* service = NotificationService::current();
@@ -1052,9 +1055,12 @@
NewTabHTMLSource* html_source = new NewTabHTMLSource();
- g_browser_process->io_thread()->message_loop()->PostTask(FROM_HERE,
- NewRunnableMethod(&chrome_url_data_manager,
- &ChromeURLDataManager::AddDataSource,
- html_source));
+ // 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,
+ html_source));
+ }
}
}

Powered by Google App Engine
This is Rietveld 408576698