Index: mojo/services/network/main.cc |
diff --git a/mojo/services/network/main.cc b/mojo/services/network/main.cc |
index 718a4310e912811c75ce6f2966e164782e1ab579..d47a7d66bb4cfe51aa3d37011de5baf55cb30b03 100644 |
--- a/mojo/services/network/main.cc |
+++ b/mojo/services/network/main.cc |
@@ -11,10 +11,17 @@ |
#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/bindings/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 { |
+ typedef mojo::InterfaceFactoryWithContext<mojo::NetworkServiceImpl, |
+ mojo::NetworkContext> |
+ NetworkFactory; |
+ |
public: |
Delegate() {} |
@@ -23,17 +30,20 @@ class Delegate : public mojo::ApplicationDelegate { |
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)); |
+ network_service_factory_.reset(new NetworkFactory(context_.get())); |
} |
+ // mojo::ApplicationDelegate implementation. |
virtual bool ConfigureIncomingConnection( |
mojo::ApplicationConnection* connection) MOJO_OVERRIDE { |
DCHECK(context_); |
- connection->AddService<mojo::NetworkServiceImpl>(context_.get()); |
+ connection->AddService(network_service_factory_.get()); |
return true; |
} |
private: |
scoped_ptr<mojo::NetworkContext> context_; |
+ scoped_ptr<NetworkFactory> network_service_factory_; |
}; |
extern "C" APPLICATION_EXPORT MojoResult CDECL MojoMain( |