Index: mojo/services/network/main.cc |
diff --git a/mojo/services/network/main.cc b/mojo/services/network/main.cc |
index e7455a43b3a76fa99bed1a4d5b53c0f5929637be..96e09ffe004a56c8890f72a461c0cc80a5040ad2 100644 |
--- a/mojo/services/network/main.cc |
+++ b/mojo/services/network/main.cc |
@@ -11,27 +11,40 @@ |
#include "mojo/public/cpp/application/application_connection.h" |
#include "mojo/public/cpp/application/application_delegate.h" |
#include "mojo/public/cpp/application/application_impl.h" |
+#include "mojo/public/cpp/application/interface_factory_with_context.h" |
+#include "mojo/public/cpp/bindings/interface_ptr.h" |
+#include "mojo/public/interfaces/service_provider/service_provider.mojom.h" |
#include "mojo/services/network/network_context.h" |
#include "mojo/services/network/network_service_impl.h" |
-class Delegate : public mojo::ApplicationDelegate { |
+class Delegate : public mojo::ApplicationDelegate, |
+ public mojo::InterfaceFactory<mojo::NetworkService> { |
public: |
Delegate() {} |
- virtual void Initialize(mojo::ApplicationImpl* app) MOJO_OVERRIDE { |
+ virtual void Initialize(mojo::ApplicationImpl* app) OVERRIDE { |
base::FilePath base_path; |
CHECK(PathService::Get(base::DIR_TEMP, &base_path)); |
base_path = base_path.Append(FILE_PATH_LITERAL("network_service")); |
context_.reset(new mojo::NetworkContext(base_path)); |
} |
+ // mojo::ApplicationDelegate implementation. |
virtual bool ConfigureIncomingConnection( |
- mojo::ApplicationConnection* connection) MOJO_OVERRIDE { |
+ mojo::ApplicationConnection* connection) OVERRIDE { |
DCHECK(context_); |
- connection->AddService<mojo::NetworkServiceImpl>(context_.get()); |
+ connection->AddService(this); |
return true; |
} |
+ // mojo::InterfaceFactory<mojo::NetworkService> implementation. |
+ virtual void Create( |
+ mojo::ApplicationConnection* connection, |
+ mojo::InterfaceRequest<mojo::NetworkService> request) OVERRIDE { |
+ mojo::BindToRequest( |
+ new mojo::NetworkServiceImpl(connection, context_.get()), &request); |
+ } |
+ |
private: |
scoped_ptr<mojo::NetworkContext> context_; |
}; |