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

Unified Diff: mojo/examples/keyboard/keyboard.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/examples/embedded_app/embedded_app.cc ('k') | mojo/examples/media_viewer/media_viewer.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/examples/keyboard/keyboard.cc
diff --git a/mojo/examples/keyboard/keyboard.cc b/mojo/examples/keyboard/keyboard.cc
index 0b76f393447cda35f9923ea8cf4765f053cc72b1..f4f22b74df93e25e44cee4786881f383bcb62234 100644
--- a/mojo/examples/keyboard/keyboard.cc
+++ b/mojo/examples/keyboard/keyboard.cc
@@ -10,9 +10,11 @@
#include "mojo/examples/keyboard/keyboard_view.h"
#include "mojo/public/cpp/application/application_connection.h"
#include "mojo/public/cpp/application/application_delegate.h"
+#include "mojo/public/cpp/application/interface_factory_with_context.h"
#include "mojo/services/public/cpp/view_manager/node.h"
#include "mojo/services/public/cpp/view_manager/view.h"
#include "mojo/services/public/cpp/view_manager/view_manager.h"
+#include "mojo/services/public/cpp/view_manager/view_manager_client_factory.h"
#include "mojo/services/public/cpp/view_manager/view_manager_delegate.h"
#include "mojo/services/public/cpp/view_manager/view_observer.h"
#include "mojo/services/public/interfaces/navigation/navigation.mojom.h"
@@ -33,7 +35,7 @@ class Keyboard;
class KeyboardServiceImpl : public InterfaceImpl<KeyboardService> {
public:
- KeyboardServiceImpl(ApplicationConnection* connection, Keyboard* keyboard);
+ explicit KeyboardServiceImpl(Keyboard* keyboard);
virtual ~KeyboardServiceImpl() {}
// KeyboardService:
@@ -45,11 +47,18 @@ class KeyboardServiceImpl : public InterfaceImpl<KeyboardService> {
DISALLOW_COPY_AND_ASSIGN(KeyboardServiceImpl);
};
-class Keyboard : public ApplicationDelegate,
- public view_manager::ViewManagerDelegate,
- public KeyboardDelegate {
+class Keyboard
+ : public ApplicationDelegate,
+ public view_manager::ViewManagerDelegate,
+ public KeyboardDelegate,
+ public InterfaceFactoryWithContext<KeyboardServiceImpl, Keyboard> {
public:
- Keyboard() : view_manager_(NULL), keyboard_service_(NULL), target_(0) {}
+ Keyboard()
+ : InterfaceFactoryWithContext(this),
+ view_manager_(NULL),
+ view_manager_client_factory_(this),
+ keyboard_service_(NULL),
+ target_(0) {}
virtual ~Keyboard() {
}
@@ -65,8 +74,8 @@ class Keyboard : public ApplicationDelegate,
virtual bool ConfigureIncomingConnection(ApplicationConnection* connection)
MOJO_OVERRIDE {
views_init_.reset(new ViewsInit);
- view_manager::ViewManager::ConfigureIncomingConnection(connection, this);
- connection->AddService<KeyboardServiceImpl>(this);
+ connection->AddService(&view_manager_client_factory_);
+ connection->AddService(this);
return true;
}
@@ -111,6 +120,7 @@ class Keyboard : public ApplicationDelegate,
scoped_ptr<ViewsInit> views_init_;
view_manager::ViewManager* view_manager_;
+ view_manager::ViewManagerClientFactory view_manager_client_factory_;
KeyboardServiceImpl* keyboard_service_;
@@ -119,8 +129,7 @@ class Keyboard : public ApplicationDelegate,
DISALLOW_COPY_AND_ASSIGN(Keyboard);
};
-KeyboardServiceImpl::KeyboardServiceImpl(ApplicationConnection* connection,
- Keyboard* keyboard)
+KeyboardServiceImpl::KeyboardServiceImpl(Keyboard* keyboard)
: keyboard_(keyboard) {
keyboard_->set_keyboard_service(this);
}
« no previous file with comments | « mojo/examples/embedded_app/embedded_app.cc ('k') | mojo/examples/media_viewer/media_viewer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698