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

Unified Diff: mojo/public/cpp/application/connect.h

Issue 1435153003: Add an ApplicationConnector interface, etc. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: grrr Created 5 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: mojo/public/cpp/application/connect.h
diff --git a/mojo/public/cpp/application/connect.h b/mojo/public/cpp/application/connect.h
index 964c55f8fb63830d3872848634553e86cced6022..fb47f5e660ddeecff2a98b06b53d2b54b334cea7 100644
--- a/mojo/public/cpp/application/connect.h
+++ b/mojo/public/cpp/application/connect.h
@@ -5,6 +5,7 @@
#ifndef MOJO_PUBLIC_CPP_APPLICATION_CONNECT_H_
#define MOJO_PUBLIC_CPP_APPLICATION_CONNECT_H_
+#include "mojo/public/interfaces/application/application_connector.mojom.h"
#include "mojo/public/interfaces/application/service_provider.mojom.h"
#include "mojo/public/interfaces/application/shell.mojom.h"
@@ -30,6 +31,17 @@ inline void ConnectToService(Shell* shell,
ConnectToService(service_provider.get(), ptr);
}
+// Binds |ptr| to a remote implementation of Interface from |application_url|.
+template <typename Interface>
+inline void ConnectToService(ApplicationConnector* application_connector,
+ const std::string& application_url,
+ InterfacePtr<Interface>* ptr) {
+ ServiceProviderPtr service_provider;
+ application_connector->ConnectToApplication(
+ application_url, GetProxy(&service_provider), nullptr);
+ ConnectToService(service_provider.get(), ptr);
+}
+
} // namespace mojo
#endif // MOJO_PUBLIC_CPP_APPLICATION_CONNECT_H_

Powered by Google App Engine
This is Rietveld 408576698