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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "build/build_config.h" 5 #include "build/build_config.h"
6 6
7 #include "chrome/browser/dom_ui/new_tab_ui.h" 7 #include "chrome/browser/dom_ui/new_tab_ui.h"
8 8
9 #include "base/histogram.h" 9 #include "base/histogram.h"
10 #include "base/string_piece.h" 10 #include "base/string_piece.h"
(...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after
375 }; 375 };
376 376
377 MostVisitedHandler::MostVisitedHandler(DOMUI* dom_ui) 377 MostVisitedHandler::MostVisitedHandler(DOMUI* dom_ui)
378 : DOMMessageHandler(dom_ui), 378 : DOMMessageHandler(dom_ui),
379 dom_ui_(dom_ui) { 379 dom_ui_(dom_ui) {
380 // Register ourselves as the handler for the "mostvisited" message from 380 // Register ourselves as the handler for the "mostvisited" message from
381 // Javascript. 381 // Javascript.
382 dom_ui_->RegisterMessageCallback("getMostVisited", 382 dom_ui_->RegisterMessageCallback("getMostVisited",
383 NewCallback(this, &MostVisitedHandler::HandleGetMostVisited)); 383 NewCallback(this, &MostVisitedHandler::HandleGetMostVisited));
384 384
385 // Set up our sources for thumbnail and favicon data. 385 // Set up our sources for thumbnail and favicon data. Since we may be in
386 // Ownership is passed to the ChromeURLDataManager. 386 // testing mode with no I/O thread, only add our handler when an I/O thread
387 g_browser_process->io_thread()->message_loop()->PostTask(FROM_HERE, 387 // exists. Ownership is passed to the ChromeURLDataManager.
388 NewRunnableMethod(&chrome_url_data_manager, 388 if (g_browser_process->io_thread()) {
389 &ChromeURLDataManager::AddDataSource, 389 g_browser_process->io_thread()->message_loop()->PostTask(FROM_HERE,
390 new DOMUIThumbnailSource(dom_ui->GetProfile()))); 390 NewRunnableMethod(&chrome_url_data_manager,
391 g_browser_process->io_thread()->message_loop()->PostTask(FROM_HERE, 391 &ChromeURLDataManager::AddDataSource,
392 NewRunnableMethod(&chrome_url_data_manager, 392 new DOMUIThumbnailSource(dom_ui->GetProfile())));
393 &ChromeURLDataManager::AddDataSource, 393 g_browser_process->io_thread()->message_loop()->PostTask(FROM_HERE,
394 new DOMUIFavIconSource(dom_ui->GetProfile()))); 394 NewRunnableMethod(&chrome_url_data_manager,
395 &ChromeURLDataManager::AddDataSource,
396 new DOMUIFavIconSource(dom_ui->GetProfile())));
397 }
395 398
396 // Get notifications when history is cleared. 399 // Get notifications when history is cleared.
397 NotificationService* service = NotificationService::current(); 400 NotificationService* service = NotificationService::current();
398 service->AddObserver(this, NotificationType::HISTORY_URLS_DELETED, 401 service->AddObserver(this, NotificationType::HISTORY_URLS_DELETED,
399 Source<Profile>(dom_ui_->GetProfile())); 402 Source<Profile>(dom_ui_->GetProfile()));
400 } 403 }
401 404
402 MostVisitedHandler::~MostVisitedHandler() { 405 MostVisitedHandler::~MostVisitedHandler() {
403 NotificationService* service = NotificationService::current(); 406 NotificationService* service = NotificationService::current();
404 service->RemoveObserver(this, NotificationType::HISTORY_URLS_DELETED, 407 service->RemoveObserver(this, NotificationType::HISTORY_URLS_DELETED,
(...skipping 640 matching lines...) Expand 10 before | Expand all | Expand 10 after
1045 AddMessageHandler(new HistoryHandler(this)); 1048 AddMessageHandler(new HistoryHandler(this));
1046 AddMessageHandler(new MetricsHandler(this)); 1049 AddMessageHandler(new MetricsHandler(this));
1047 #ifdef CHROME_PERSONALIZATION 1050 #ifdef CHROME_PERSONALIZATION
1048 if (!Personalization::IsP13NDisabled()) { 1051 if (!Personalization::IsP13NDisabled()) {
1049 AddMessageHandler(Personalization::CreateNewTabPageHandler(this)); 1052 AddMessageHandler(Personalization::CreateNewTabPageHandler(this));
1050 } 1053 }
1051 #endif 1054 #endif
1052 1055
1053 NewTabHTMLSource* html_source = new NewTabHTMLSource(); 1056 NewTabHTMLSource* html_source = new NewTabHTMLSource();
1054 1057
1055 g_browser_process->io_thread()->message_loop()->PostTask(FROM_HERE, 1058 // In testing mode there may not be an I/O thread.
1056 NewRunnableMethod(&chrome_url_data_manager, 1059 if (g_browser_process->io_thread()) {
1057 &ChromeURLDataManager::AddDataSource, 1060 g_browser_process->io_thread()->message_loop()->PostTask(FROM_HERE,
1058 html_source)); 1061 NewRunnableMethod(&chrome_url_data_manager,
1062 &ChromeURLDataManager::AddDataSource,
1063 html_source));
1064 }
1059 } 1065 }
1060 } 1066 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698