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

Unified Diff: mojo/examples/surfaces_app/child_app.cc

Issue 380413003: Mojo: Use InterfaceFactory<Interface> for service registration (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: specify ownership in the Bind call 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/examples/surfaces_app/child_app.cc
diff --git a/mojo/examples/surfaces_app/child_app.cc b/mojo/examples/surfaces_app/child_app.cc
index 0a5c03424fb7d7937992fcca19df8cb0a41567e0..02db9690e269fd0cbf263e2408f802c1692e68f1 100644
--- a/mojo/examples/surfaces_app/child_app.cc
+++ b/mojo/examples/surfaces_app/child_app.cc
@@ -11,28 +11,31 @@
namespace mojo {
namespace examples {
-class ChildApp : public ApplicationDelegate, public ChildImpl::Context {
+class ChildApp : public ApplicationDelegate, public InterfaceProvider<Child> {
public:
ChildApp() {}
virtual ~ChildApp() {}
- virtual void Initialize(ApplicationImpl* app) OVERRIDE { app_ = app; }
+ virtual void Initialize(ApplicationImpl* app) OVERRIDE {
+ surfaces_service_connection_ =
+ app->ConnectToApplication("mojo:mojo_surfaces_service");
+ }
// ApplicationDelegate implementation.
virtual bool ConfigureIncomingConnection(
ApplicationConnection* connection) OVERRIDE {
- connection->AddService<ChildImpl, ChildImpl::Context>(this);
+ connection->AddServiceProvider(this);
return true;
}
- // ChildImpl::Context implementation.
- virtual ApplicationConnection* ShellConnection(
- const mojo::String& application_url) OVERRIDE {
- return app_->ConnectToApplication(application_url);
+ // InterfaceProvider<Child> implementation.
+ virtual void BindToRequest(ApplicationConnection* connection,
+ InterfaceRequest<Child> request) OVERRIDE {
+ mojo::BindToRequest(new ChildImpl(surfaces_service_connection_), &request);
}
private:
- ApplicationImpl* app_;
+ ApplicationConnection* surfaces_service_connection_;
DISALLOW_COPY_AND_ASSIGN(ChildApp);
};

Powered by Google App Engine
This is Rietveld 408576698