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

Unified Diff: mojo/services/network/main.cc

Issue 380413003: Mojo: Use InterfaceFactory<Interface> for service registration (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix network_service_loader 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
« no previous file with comments | « mojo/services/native_viewport/native_viewport_service.cc ('k') | mojo/services/network/url_loader_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_;
};
« no previous file with comments | « mojo/services/native_viewport/native_viewport_service.cc ('k') | mojo/services/network/url_loader_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698