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

Unified Diff: examples/wm_flow/app/app.cc

Issue 898013004: Remove uses of InterfaceImpl in wm_flow example (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 10 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 | examples/wm_flow/embedded/embedded.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: examples/wm_flow/app/app.cc
diff --git a/examples/wm_flow/app/app.cc b/examples/wm_flow/app/app.cc
index 7a1171e574781bd9848f0bb6fe093317bf1c1388..8827191c8fa272baed7f6135fbb65b75d2846c53 100644
--- a/examples/wm_flow/app/app.cc
+++ b/examples/wm_flow/app/app.cc
@@ -19,6 +19,7 @@
#include "mojo/public/cpp/application/connect.h"
#include "mojo/public/cpp/application/interface_factory_impl.h"
#include "mojo/public/cpp/application/service_provider_impl.h"
+#include "mojo/public/cpp/bindings/strong_binding.h"
#include "mojo/public/interfaces/application/service_provider.mojom.h"
#include "mojo/services/view_manager/public/cpp/view.h"
#include "mojo/services/view_manager/public/cpp/view_manager.h"
@@ -34,17 +35,19 @@ namespace {
const SkColor kColors[] = { SK_ColorRED, SK_ColorGREEN, SK_ColorYELLOW };
-class EmbedderImpl : public mojo::InterfaceImpl<Embedder> {
+class EmbedderImpl : public Embedder {
public:
- EmbedderImpl() {}
- virtual ~EmbedderImpl() {}
+ explicit EmbedderImpl(mojo::InterfaceRequest<Embedder> request)
+ : binding_(this, request.Pass()) {}
+ ~EmbedderImpl() override {}
private:
// Overridden from Embedder:
- virtual void HelloWorld(const mojo::Callback<void()>& callback) override {
+ void HelloWorld(const mojo::Callback<void()>& callback) override {
callback.Run();
}
+ mojo::StrongBinding<Embedder> binding_;
DISALLOW_COPY_AND_ASSIGN(EmbedderImpl);
};
@@ -63,8 +66,7 @@ class EmbedderImplProvider : public mojo::ServiceProvider {
mojo::ScopedMessagePipeHandle pipe_handle) override {
if (interface_name != Embedder::Name_)
return;
- auto request = mojo::MakeRequest<Embedder>(pipe_handle.Pass());
- mojo::BindToRequest(new EmbedderImpl, &request);
+ new EmbedderImpl(mojo::MakeRequest<Embedder>(pipe_handle.Pass()));
}
mojo::WeakBindingSet<mojo::ServiceProvider> embeddee_exposed_services_;
« no previous file with comments | « no previous file | examples/wm_flow/embedded/embedded.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698