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

Unified Diff: mojo/services/launcher/launcher.cc

Issue 380413003: Mojo: Use InterfaceFactory<Interface> for service registration (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: some InterfaceProvider impls for common cases Created 6 years, 5 months 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/services/launcher/launcher.cc
diff --git a/mojo/services/launcher/launcher.cc b/mojo/services/launcher/launcher.cc
index f9fc881c807a1b0186447a9c7f400aa379e59aee..10ba604fe1fda46a01db3bcc74873a88fd4e7d71 100644
--- a/mojo/services/launcher/launcher.cc
+++ b/mojo/services/launcher/launcher.cc
@@ -26,10 +26,9 @@ typedef mojo::Callback<void(String handler_url, String view_url,
class LauncherApp;
-class LauncherConnection : public InterfaceImpl<Launcher> {
+class LauncherConnection : public InterfaceImplDeleteOnError<Launcher> {
public:
- LauncherConnection(ApplicationConnection* connection, LauncherApp* app)
- : app_(app) {}
+ explicit LauncherConnection(LauncherApp* app) : app_(app) {}
virtual ~LauncherConnection() {}
private:
@@ -94,7 +93,8 @@ class LaunchInstance : public URLLoaderClient {
DISALLOW_COPY_AND_ASSIGN(LaunchInstance);
};
-class LauncherApp : public ApplicationDelegate {
+class LauncherApp : public ApplicationDelegate,
+ public InterfaceProvider<Launcher> {
public:
LauncherApp() {
handler_map_["text/html"] = "mojo:mojo_html_viewer";
@@ -123,10 +123,16 @@ class LauncherApp : public ApplicationDelegate {
virtual bool ConfigureIncomingConnection(ApplicationConnection* connection)
MOJO_OVERRIDE {
- connection->AddService<LauncherConnection>(this);
+ connection->AddServiceProvider(this);
return true;
}
+ // Overridden from InterfaceProvider<Launcher>
+ virtual void BindToRequest(ApplicationConnection* connection,
+ InterfaceRequest<Launcher> request) OVERRIDE {
+ mojo::BindToRequest(new LauncherConnection(this), &request);
+ }
+
HandlerMap handler_map_;
NetworkServicePtr network_service_;

Powered by Google App Engine
This is Rietveld 408576698