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

Unified Diff: chrome/browser/importer/external_process_importer_host.cc

Issue 23710022: Convert NOTIFICATION_TEMPLATE_URL_SERVICE_LOADED to CallbackList (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Clean-up Created 7 years, 2 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/importer/external_process_importer_host.cc
diff --git a/chrome/browser/importer/external_process_importer_host.cc b/chrome/browser/importer/external_process_importer_host.cc
index 28ccd3ffe3b9b0fc72221ae8f92417b7584d1900..9af964193f37f3a8461a53e7ad27d54e5435a7e4 100644
--- a/chrome/browser/importer/external_process_importer_host.cc
+++ b/chrome/browser/importer/external_process_importer_host.cc
@@ -16,7 +16,6 @@
#include "chrome/browser/search_engines/template_url_service.h"
#include "chrome/browser/search_engines/template_url_service_factory.h"
#include "content/public/browser/browser_thread.h"
-#include "content/public/browser/notification_source.h"
using content::BrowserThread;
@@ -99,7 +98,7 @@ ExternalProcessImporterHost::~ExternalProcessImporterHost() {
}
void ExternalProcessImporterHost::LaunchImportIfReady() {
- if (waiting_for_bookmarkbar_model_ || !registrar_.IsEmpty() ||
+ if (waiting_for_bookmarkbar_model_ || template_service_subscription_.get() ||
!is_source_readable_ || cancelled_)
return;
@@ -135,11 +134,8 @@ void ExternalProcessImporterHost::BookmarkModelBeingDeleted(
void ExternalProcessImporterHost::BookmarkModelChanged() {
}
-void ExternalProcessImporterHost::Observe(int type,
- const content::NotificationSource& source,
- const content::NotificationDetails& details) {
- DCHECK_EQ(type, chrome::NOTIFICATION_TEMPLATE_URL_SERVICE_LOADED);
- registrar_.RemoveAll();
+void ExternalProcessImporterHost::OnTemplateURLServiceLoaded() {
+ template_service_subscription_.reset();
LaunchImportIfReady();
}
@@ -208,8 +204,9 @@ void ExternalProcessImporterHost::CheckForLoadedModels(uint16 items) {
if (!writer_->TemplateURLServiceIsLoaded()) {
TemplateURLService* model =
TemplateURLServiceFactory::GetForProfile(profile_);
- registrar_.Add(this, chrome::NOTIFICATION_TEMPLATE_URL_SERVICE_LOADED,
- content::Source<TemplateURLService>(model));
+ template_service_subscription_ = model->RegisterOnLoadedCallback(
+ base::Bind(&ExternalProcessImporterHost::OnTemplateURLServiceLoaded,
+ weak_ptr_factory_.GetWeakPtr()));
model->Load();
}
}

Powered by Google App Engine
This is Rietveld 408576698