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

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: convert everything over, remove ApplicationConnection::AddService 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..75e7fba97ae90b8bc9e30eb3b5282d0cd41d6b38 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 InterfaceFactory<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->AddServiceFactory(this);
return true;
}
- // ChildImpl::Context implementation.
- virtual ApplicationConnection* ShellConnection(
- const mojo::String& application_url) OVERRIDE {
- return app_->ConnectToApplication(application_url);
+ // InterfaceFactory<Child> implementation.
+ virtual void Create(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