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

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: 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/keyboard/keyboard.cc
diff --git a/mojo/examples/keyboard/keyboard.cc b/mojo/examples/keyboard/keyboard.cc
index 0b76f393447cda35f9923ea8cf4765f053cc72b1..8f4fdf8189802e5a8bcb146f29be0128e23cd779 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/context_interface_factory.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:
@@ -47,9 +49,15 @@ class KeyboardServiceImpl : public InterfaceImpl<KeyboardService> {
class Keyboard : public ApplicationDelegate,
public view_manager::ViewManagerDelegate,
- public KeyboardDelegate {
+ public KeyboardDelegate,
+ public ContextInterfaceFactory<KeyboardServiceImpl, Keyboard> {
public:
- Keyboard() : view_manager_(NULL), keyboard_service_(NULL), target_(0) {}
+ Keyboard()
+ : ContextInterfaceFactory(this),
+ view_manager_(NULL),
+ view_manager_client_factory_(this),
+ keyboard_service_(NULL),
+ target_(0) {}
virtual ~Keyboard() {
}
@@ -65,8 +73,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->AddServiceFactory(&view_manager_client_factory_);
+ connection->AddServiceFactory(this);
return true;
}
@@ -111,6 +119,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 +128,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);
}

Powered by Google App Engine
This is Rietveld 408576698