Chromium Code Reviews| Index: chrome/utility/importer/external_process_importer_bridge.h |
| diff --git a/chrome/utility/importer/external_process_importer_bridge.h b/chrome/utility/importer/external_process_importer_bridge.h |
| index 0a22e7e50f69be187e50467b60547ed4382dd5b5..df7a4b48fa78129e8df27a8279aec13687fe4d58 100644 |
| --- a/chrome/utility/importer/external_process_importer_bridge.h |
| +++ b/chrome/utility/importer/external_process_importer_bridge.h |
| @@ -31,10 +31,11 @@ struct ImporterURLRow; |
| struct SearchEngineInfo; |
| } |
| -namespace IPC { |
| -class Message; |
| -class Sender; |
| -} |
| +namespace chrome { |
| +namespace mojom { |
| +class ProfileImportObserver; |
| +} // namespace mojom |
| +} // namespace chrome |
| // When the importer is run in an external process, the bridge is effectively |
| // split in half by the IPC infrastructure. The external bridge receives data |
| @@ -43,10 +44,10 @@ class Sender; |
| // profile. |
| class ExternalProcessImporterBridge : public ImporterBridge { |
|
Sam McNally
2016/11/07 06:31:07
It feels like ImporterBridge, ProfileWriter or som
tibell
2016/11/07 23:34:24
Done.
|
| public: |
| - ExternalProcessImporterBridge( |
| - const base::DictionaryValue& localized_strings, |
| - IPC::Sender* sender, |
| - base::TaskRunner* task_runner); |
| + // |observer| must outlive this object. |
| + ExternalProcessImporterBridge(const base::DictionaryValue& localized_strings, |
| + base::TaskRunner* task_runner, |
| + chrome::mojom::ProfileImportObserver* observer); |
| // Begin ImporterBridge implementation: |
| void AddBookmarks(const std::vector<ImportedBookmarkEntry>& bookmarks, |
| @@ -87,16 +88,21 @@ class ExternalProcessImporterBridge : public ImporterBridge { |
| private: |
| ~ExternalProcessImporterBridge() override; |
| - void Send(IPC::Message* message); |
| - void SendInternal(IPC::Message* message); |
| + // Helper to send messages through |observer_| on the right thread. First |
| + // argument should be a method on chrome::mojom::ProfileImportObserver and the |
| + // remaining arguments should be the arguments to pass to that method. |
| + template <typename Functor, typename... Args> |
| + void Send(Functor&& functor, Args&&... args); |
| // Holds strings needed by the external importer because the resource |
| // bundle isn't available to the external process. |
| std::unique_ptr<base::DictionaryValue> localized_strings_; |
| - IPC::Sender* sender_; |
| + // The task runner that |observer_| methods must be called on. |
| scoped_refptr<base::TaskRunner> task_runner_; |
| + chrome::mojom::ProfileImportObserver* observer_; |
| + |
| DISALLOW_COPY_AND_ASSIGN(ExternalProcessImporterBridge); |
| }; |