| 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();
|
| }
|
| }
|
|
|