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

Unified Diff: mojo/examples/view_manager/view_manager.cc

Issue 198343002: Mojo: request/response bindings (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 years, 9 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 | « no previous file | mojo/examples/view_manager/view_manager.mojom » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/examples/view_manager/view_manager.cc
diff --git a/mojo/examples/view_manager/view_manager.cc b/mojo/examples/view_manager/view_manager.cc
index 69e59367cbb6267716a48129578349651d0ef9a7..9fbe48b3fc846d2e15ee92112388e85133048914 100644
--- a/mojo/examples/view_manager/view_manager.cc
+++ b/mojo/examples/view_manager/view_manager.cc
@@ -36,9 +36,9 @@ namespace examples {
class ViewImpl : public View {
public:
- explicit ViewImpl(ScopedViewClientHandle client_handle)
+ explicit ViewImpl(ScopedViewClientHandle handle)
: id_(-1),
- client_(client_handle.Pass()) {}
+ client_(handle.Pass(), this) {}
virtual ~ViewImpl() {}
private:
@@ -46,8 +46,9 @@ class ViewImpl : public View {
virtual void SetId(int view_id) MOJO_OVERRIDE {
id_ = view_id;
}
- virtual void GetId() MOJO_OVERRIDE {
- client_->OnGotId(id_);
+ virtual void GetId(const mojo::Callback<void(int32_t)>& callback)
+ MOJO_OVERRIDE {
+ callback.Run(id_);
}
int id_;
@@ -66,10 +67,11 @@ class ViewManagerImpl : public Service<ViewManager, ViewManagerImpl>,
private:
// Overridden from ViewManager:
- virtual void CreateView() MOJO_OVERRIDE {
+ virtual void CreateView(const Callback<void(ScopedViewHandle)>& callback)
+ MOJO_OVERRIDE {
InterfacePipe<View> pipe;
views_.push_back(new ViewImpl(pipe.handle_to_peer.Pass()));
- client()->OnViewCreated(pipe.handle_to_self.Pass());
+ callback.Run(pipe.handle_to_self.Pass());
}
// Overridden from NativeViewportClient:
« no previous file with comments | « no previous file | mojo/examples/view_manager/view_manager.mojom » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698