| Index: chrome/utility/importer/external_process_importer_bridge.cc | 
| diff --git a/chrome/utility/importer/external_process_importer_bridge.cc b/chrome/utility/importer/external_process_importer_bridge.cc | 
| index d1e4cda7fce1e12c91a543d3f502c7eaf2ad3375..2203010d8b4f0be3efa1ecbfd933c8935060f5f4 100644 | 
| --- a/chrome/utility/importer/external_process_importer_bridge.cc | 
| +++ b/chrome/utility/importer/external_process_importer_bridge.cc | 
| @@ -13,10 +13,12 @@ | 
| #include "base/values.h" | 
| #include "build/build_config.h" | 
| #include "chrome/common/importer/imported_bookmark_entry.h" | 
| +#include "chrome/common/importer/importer_autofill_form_data_entry.h" | 
| #include "chrome/common/importer/importer_data_types.h" | 
| -#include "chrome/common/importer/profile_import_process_messages.h" | 
| +#include "chrome/common/importer/profile_import.mojom.h" | 
| #include "components/autofill/core/common/password_form.h" | 
| -#include "ipc/ipc_sender.h" | 
| + | 
| +using chrome::mojom::ProfileImportObserver; | 
|  | 
| namespace { | 
|  | 
| @@ -32,10 +34,9 @@ const int kNumAutofillFormDataToSend = 100; | 
|  | 
| ExternalProcessImporterBridge::ExternalProcessImporterBridge( | 
| const base::DictionaryValue& localized_strings, | 
| -    IPC::Sender* sender, | 
| -    base::TaskRunner* task_runner) | 
| -    : sender_(sender), | 
| -      task_runner_(task_runner) { | 
| +    base::TaskRunner* task_runner, | 
| +    ProfileImportObserver* observer) | 
| +    : task_runner_(task_runner), observer_(observer) { | 
| // Bridge needs to make its own copy because OS 10.6 autoreleases the | 
| // localized_strings value that is passed in (see http://crbug.com/46003 ). | 
| localized_strings_.reset(localized_strings.DeepCopy()); | 
| @@ -44,8 +45,8 @@ ExternalProcessImporterBridge::ExternalProcessImporterBridge( | 
| void ExternalProcessImporterBridge::AddBookmarks( | 
| const std::vector<ImportedBookmarkEntry>& bookmarks, | 
| const base::string16& first_folder_name) { | 
| -  Send(new ProfileImportProcessHostMsg_NotifyBookmarksImportStart( | 
| -      first_folder_name, bookmarks.size())); | 
| +  Send(&ProfileImportObserver::OnBookmarksImportStart, first_folder_name, | 
| +       bookmarks.size()); | 
|  | 
| // |bookmarks_left| is required for the checks below as Windows has a | 
| // Debug bounds-check which prevents pushing an iterator beyond its end() | 
| @@ -58,8 +59,7 @@ void ExternalProcessImporterBridge::AddBookmarks( | 
| it + std::min(bookmarks_left, kNumBookmarksToSend); | 
| bookmark_group.assign(it, end_group); | 
|  | 
| -    Send(new ProfileImportProcessHostMsg_NotifyBookmarksImportGroup( | 
| -        bookmark_group)); | 
| +    Send(&ProfileImportObserver::OnBookmarksImportGroup, bookmark_group); | 
| bookmarks_left -= end_group - it; | 
| it = end_group; | 
| } | 
| @@ -67,20 +67,19 @@ void ExternalProcessImporterBridge::AddBookmarks( | 
| } | 
|  | 
| void ExternalProcessImporterBridge::AddHomePage(const GURL& home_page) { | 
| -  Send(new ProfileImportProcessHostMsg_NotifyHomePageImportReady(home_page)); | 
| +  Send(&ProfileImportObserver::OnHomePageImportReady, home_page); | 
| } | 
|  | 
| #if defined(OS_WIN) | 
| void ExternalProcessImporterBridge::AddIE7PasswordInfo( | 
| const importer::ImporterIE7PasswordInfo& password_info) { | 
| -  Send(new ProfileImportProcessHostMsg_NotifyIE7PasswordInfo(password_info)); | 
| +  Send(&ProfileImportObserver::OnIE7PasswordReceived, password_info); | 
| } | 
| #endif | 
|  | 
| void ExternalProcessImporterBridge::SetFavicons( | 
| const favicon_base::FaviconUsageDataList& favicons) { | 
| -  Send(new ProfileImportProcessHostMsg_NotifyFaviconsImportStart( | 
| -    favicons.size())); | 
| +  Send(&ProfileImportObserver::OnFaviconsImportStart, favicons.size()); | 
|  | 
| // |favicons_left| is required for the checks below as Windows has a | 
| // Debug bounds-check which prevents pushing an iterator beyond its end() | 
| @@ -93,8 +92,7 @@ void ExternalProcessImporterBridge::SetFavicons( | 
| it + std::min(favicons_left, kNumFaviconsToSend); | 
| favicons_group.assign(it, end_group); | 
|  | 
| -    Send(new ProfileImportProcessHostMsg_NotifyFaviconsImportGroup( | 
| -        favicons_group)); | 
| +    Send(&ProfileImportObserver::OnFaviconsImportGroup, favicons_group); | 
| favicons_left -= end_group - it; | 
| it = end_group; | 
| } | 
| @@ -104,7 +102,7 @@ void ExternalProcessImporterBridge::SetFavicons( | 
| void ExternalProcessImporterBridge::SetHistoryItems( | 
| const std::vector<ImporterURLRow>& rows, | 
| importer::VisitSource visit_source) { | 
| -  Send(new ProfileImportProcessHostMsg_NotifyHistoryImportStart(rows.size())); | 
| +  Send(&ProfileImportObserver::OnHistoryImportStart, rows.size()); | 
|  | 
| // |rows_left| is required for the checks below as Windows has a | 
| // Debug bounds-check which prevents pushing an iterator beyond its end() | 
| @@ -117,8 +115,7 @@ void ExternalProcessImporterBridge::SetHistoryItems( | 
| it + std::min(rows_left, kNumHistoryRowsToSend); | 
| row_group.assign(it, end_group); | 
|  | 
| -    Send(new ProfileImportProcessHostMsg_NotifyHistoryImportGroup( | 
| -        row_group, visit_source)); | 
| +    Send(&ProfileImportObserver::OnHistoryImportGroup, row_group, visit_source); | 
| rows_left -= end_group - it; | 
| it = end_group; | 
| } | 
| @@ -128,25 +125,24 @@ void ExternalProcessImporterBridge::SetHistoryItems( | 
| void ExternalProcessImporterBridge::SetKeywords( | 
| const std::vector<importer::SearchEngineInfo>& search_engines, | 
| bool unique_on_host_and_path) { | 
| -  Send(new ProfileImportProcessHostMsg_NotifyKeywordsReady( | 
| -      search_engines, unique_on_host_and_path)); | 
| +  Send(&ProfileImportObserver::OnKeywordsImportReady, search_engines, | 
| +       unique_on_host_and_path); | 
| } | 
|  | 
| void ExternalProcessImporterBridge::SetFirefoxSearchEnginesXMLData( | 
| const std::vector<std::string>& search_engine_data) { | 
| -  Send(new ProfileImportProcessHostMsg_NotifyFirefoxSearchEngData( | 
| -      search_engine_data)); | 
| +  Send(&ProfileImportObserver::OnFirefoxSearchEngineDataReceived, | 
| +       search_engine_data); | 
| } | 
|  | 
| void ExternalProcessImporterBridge::SetPasswordForm( | 
| const autofill::PasswordForm& form) { | 
| -  Send(new ProfileImportProcessHostMsg_NotifyPasswordFormReady(form)); | 
| +  Send(&ProfileImportObserver::OnPasswordFormImportReady, form); | 
| } | 
|  | 
| void ExternalProcessImporterBridge::SetAutofillFormData( | 
| const std::vector<ImporterAutofillFormDataEntry>& entries) { | 
| -  Send(new ProfileImportProcessHostMsg_AutofillFormDataImportStart( | 
| -      entries.size())); | 
| +  Send(&ProfileImportObserver::OnAutofillFormDataImportStart, entries.size()); | 
|  | 
| // |autofill_form_data_entries_left| is required for the checks below as | 
| // Windows has a Debug bounds-check which prevents pushing an iterator beyond | 
| @@ -162,8 +158,8 @@ void ExternalProcessImporterBridge::SetAutofillFormData( | 
| std::min(autofill_form_data_entries_left, kNumAutofillFormDataToSend); | 
| autofill_form_data_entry_group.assign(it, end_group); | 
|  | 
| -    Send(new ProfileImportProcessHostMsg_AutofillFormDataImportGroup( | 
| -        autofill_form_data_entry_group)); | 
| +    Send(&ProfileImportObserver::OnAutofillFormDataImportGroup, | 
| +         autofill_form_data_entry_group); | 
| autofill_form_data_entries_left -= end_group - it; | 
| it = end_group; | 
| } | 
| @@ -171,16 +167,16 @@ void ExternalProcessImporterBridge::SetAutofillFormData( | 
| } | 
|  | 
| void ExternalProcessImporterBridge::NotifyStarted() { | 
| -  Send(new ProfileImportProcessHostMsg_Import_Started()); | 
| +  Send(&ProfileImportObserver::OnImportStart); | 
| } | 
|  | 
| void ExternalProcessImporterBridge::NotifyItemStarted( | 
| importer::ImportItem item) { | 
| -  Send(new ProfileImportProcessHostMsg_ImportItem_Started(item)); | 
| +  Send(&ProfileImportObserver::OnImportItemStart, item); | 
| } | 
|  | 
| void ExternalProcessImporterBridge::NotifyItemEnded(importer::ImportItem item) { | 
| -  Send(new ProfileImportProcessHostMsg_ImportItem_Finished(item)); | 
| +  Send(&ProfileImportObserver::OnImportItemFinished, item); | 
| } | 
|  | 
| void ExternalProcessImporterBridge::NotifyEnded() { | 
| @@ -196,14 +192,9 @@ base::string16 ExternalProcessImporterBridge::GetLocalizedString( | 
|  | 
| ExternalProcessImporterBridge::~ExternalProcessImporterBridge() {} | 
|  | 
| -void ExternalProcessImporterBridge::Send(IPC::Message* message) { | 
| -  task_runner_->PostTask( | 
| -      FROM_HERE, | 
| -      base::Bind(&ExternalProcessImporterBridge::SendInternal, | 
| -                 this, message)); | 
| -} | 
| - | 
| -void ExternalProcessImporterBridge::SendInternal(IPC::Message* message) { | 
| -  DCHECK(task_runner_->RunsTasksOnCurrentThread()); | 
| -  sender_->Send(message); | 
| +template <typename Functor, typename... Args> | 
| +void ExternalProcessImporterBridge::Send(Functor&& functor, Args&&... args) { | 
| +  task_runner_->PostTask(FROM_HERE, base::Bind(std::forward<Functor>(functor), | 
| +                                               base::Unretained(observer_), | 
| +                                               std::forward<Args>(args)...)); | 
| } | 
|  |