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

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

Issue 1397563003: Remove wm_flow, browser, nesting_app examples (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 2 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: examples/wm_flow/embedded/embedded.cc
diff --git a/examples/wm_flow/embedded/embedded.cc b/examples/wm_flow/embedded/embedded.cc
deleted file mode 100644
index f7c67f8f9bc2268c066241c476a0e1b75c7d88ca..0000000000000000000000000000000000000000
--- a/examples/wm_flow/embedded/embedded.cc
+++ /dev/null
@@ -1,115 +0,0 @@
-// Copyright 2014 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "base/bind.h"
-#include "base/macros.h"
-#include "examples/bitmap_uploader/bitmap_uploader.h"
-#include "examples/wm_flow/app/embedder.mojom.h"
-#include "examples/wm_flow/embedded/embeddee.mojom.h"
-#include "mojo/application/application_runner_chromium.h"
-#include "mojo/public/c/system/main.h"
-#include "mojo/public/cpp/application/application_connection.h"
-#include "mojo/public/cpp/application/application_delegate.h"
-#include "mojo/public/cpp/application/application_impl.h"
-#include "mojo/public/cpp/application/connect.h"
-#include "mojo/public/cpp/application/service_provider_impl.h"
-#include "mojo/public/cpp/bindings/strong_binding.h"
-#include "mojo/services/view_manager/cpp/view.h"
-#include "mojo/services/view_manager/cpp/view_manager.h"
-#include "mojo/services/view_manager/cpp/view_manager_client_factory.h"
-#include "mojo/services/view_manager/cpp/view_manager_delegate.h"
-#include "third_party/skia/include/core/SkColor.h"
-
-namespace examples {
-
-namespace {
-
-class EmbeddeeImpl : public Embeddee {
- public:
- explicit EmbeddeeImpl(mojo::InterfaceRequest<Embeddee> request)
- : binding_(this, request.Pass()) {}
- ~EmbeddeeImpl() override {}
-
- private:
- // Overridden from Embeddee:
- void HelloBack(const mojo::Callback<void()>& callback) override {
- callback.Run();
- }
-
- mojo::StrongBinding<Embeddee> binding_;
- DISALLOW_COPY_AND_ASSIGN(EmbeddeeImpl);
-};
-
-} // namespace
-
-class WMFlowEmbedded : public mojo::ApplicationDelegate,
- public mojo::ViewManagerDelegate,
- public mojo::InterfaceFactory<Embeddee> {
- public:
- WMFlowEmbedded() : shell_(nullptr) {
- embeddee_provider_impl_.AddService(this);
- }
- ~WMFlowEmbedded() override {}
-
- private:
- // Overridden from Application:
- void Initialize(mojo::ApplicationImpl* app) override {
- shell_ = app->shell();
- view_manager_client_factory_.reset(
- new mojo::ViewManagerClientFactory(app->shell(), this));
- }
- bool ConfigureIncomingConnection(
- mojo::ApplicationConnection* connection) override {
- connection->AddService(view_manager_client_factory_.get());
- return true;
- }
-
- // Overridden from mojo::ViewManagerDelegate:
- void OnEmbed(mojo::View* root,
- mojo::InterfaceRequest<mojo::ServiceProvider> services,
- mojo::ServiceProviderPtr exposed_services) override {
- bitmap_uploader_.reset(new mojo::BitmapUploader(root));
- bitmap_uploader_->Init(shell_);
- // BitmapUploader does not track view size changes, we would
- // need to subscribe to OnViewBoundsChanged and tell the bitmap uploader
- // to invalidate itself. This is better done once if had a per-view
- // object instead of holding per-view state on the ApplicationDelegate.
- bitmap_uploader_->SetColor(SK_ColorMAGENTA);
-
- embeddee_provider_impl_.Bind(services.Pass());
- // FIXME: embedder_ is wrong for the same reason the embedee_ storage is
- // wrong in app.cc. We need separate per-instance storage not on the
- // application delegate.
- mojo::ConnectToService(exposed_services.get(), &embedder_);
- embedder_->HelloWorld(base::Bind(&WMFlowEmbedded::HelloWorldAck,
- base::Unretained(this)));
- }
- void OnViewManagerDisconnected(mojo::ViewManager* view_manager) override {}
-
- // Overridden from mojo::InterfaceFactory<Embeddee>:
- void Create(mojo::ApplicationConnection* app,
- mojo::InterfaceRequest<Embeddee> request) override {
- new EmbeddeeImpl(request.Pass());
- }
-
- void HelloWorldAck() {
- printf("HelloWorld() ack'ed\n");
- }
-
- mojo::Shell* shell_;
- scoped_ptr<mojo::ViewManagerClientFactory> view_manager_client_factory_;
- EmbedderPtr embedder_;
- mojo::ServiceProviderImpl embeddee_provider_impl_;
- scoped_ptr<mojo::BitmapUploader> bitmap_uploader_;
-
- DISALLOW_COPY_AND_ASSIGN(WMFlowEmbedded);
-};
-
-} // namespace examples
-
-MojoResult MojoMain(MojoHandle application_request) {
- mojo::ApplicationRunnerChromium runner(new examples::WMFlowEmbedded);
- return runner.Run(application_request);
-}
-

Powered by Google App Engine
This is Rietveld 408576698