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

Unified Diff: chrome/utility/importer/external_process_importer_bridge.h

Issue 2470283002: Convert profile import IPCs to Mojo (Closed)
Patch Set: Address review comments Created 4 years, 1 month 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/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..4b483bff9b6befaa31035e9222d756f484c1d44e 100644
--- a/chrome/utility/importer/external_process_importer_bridge.h
+++ b/chrome/utility/importer/external_process_importer_bridge.h
@@ -31,10 +31,15 @@ struct ImporterURLRow;
struct SearchEngineInfo;
}
-namespace IPC {
-class Message;
-class Sender;
-}
+namespace chrome {
+namespace mojom {
+class ProfileImportObserver;
+} // namespace mojom
+} // namespace chrome
+
+// TODO(tibell): Now when profile import is a Mojo service perhaps ImportBride,
gab 2016/11/08 13:34:25 s/when/that/ ?
Sam McNally 2016/11/09 22:31:27 ImportBride?
tibell 2016/11/09 23:08:41 Done.
tibell 2016/11/09 23:08:41 Done.
+// ProfileWriter or something in between should be the actual Mojo interface,
+// instead of having the current split.
// 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 +48,10 @@ class Sender;
// profile.
class ExternalProcessImporterBridge : public ImporterBridge {
public:
- ExternalProcessImporterBridge(
- const base::DictionaryValue& localized_strings,
- IPC::Sender* sender,
- base::TaskRunner* task_runner);
+ // |observer| must outlive this object.
gab 2016/11/08 13:34:25 |observer| and |task_runner| must outlive this obj
Sam McNally 2016/11/09 22:31:27 |task_runner| ends up in a scoped_refptr field so
tibell 2016/11/09 23:08:41 Done.
tibell 2016/11/09 23:08:41 I went with Sam's suggestion and instead changed t
+ 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 +92,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);
};

Powered by Google App Engine
This is Rietveld 408576698