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

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: simplify the profile service loader / impl 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/network/main.cc
diff --git a/mojo/services/network/main.cc b/mojo/services/network/main.cc
index 3cfc74f43f06c5008da70af9870b89ebd2c8ee9d..d360ab2639f1276ad9541d3738ef64ac70e4483e 100644
--- a/mojo/services/network/main.cc
+++ b/mojo/services/network/main.cc
@@ -31,7 +31,8 @@ void OnPathReceived(base::FilePath* path, const mojo::String& path_as_string) {
} // namespace
-class Delegate : public mojo::ApplicationDelegate {
+class Delegate : public mojo::ApplicationDelegate,
+ public mojo::InterfaceProvider<mojo::NetworkService> {
public:
Delegate() {}
@@ -48,13 +49,21 @@ class Delegate : public mojo::ApplicationDelegate {
context_.reset(new mojo::NetworkContext(base_path));
}
+ // mojo::ApplicationDelegate implementation.
virtual bool ConfigureIncomingConnection(
mojo::ApplicationConnection* connection) MOJO_OVERRIDE {
DCHECK(context_);
- connection->AddService<mojo::NetworkServiceImpl>(context_.get());
+ connection->AddServiceProvider(this);
return true;
}
+ // mojo::InterfaceProvider<mojo::NetworkService> implementation.
+ virtual void BindToRequest(
+ mojo::ApplicationConnection* connection,
+ mojo::InterfaceRequest<mojo::NetworkService> request) MOJO_OVERRIDE {
+ mojo::BindToRequest(new mojo::NetworkServiceImpl(context_.get()), &request);
+ }
+
private:
scoped_ptr<mojo::NetworkContext> context_;
};

Powered by Google App Engine
This is Rietveld 408576698