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

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

Issue 681203002: Remove mojo/examples/pepper_container_app (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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: mojo/examples/pepper_container_app/pepper_container_app.cc
diff --git a/mojo/examples/pepper_container_app/pepper_container_app.cc b/mojo/examples/pepper_container_app/pepper_container_app.cc
deleted file mode 100644
index d8761ec37dae784503631f3cd42b324c69ff7c8c..0000000000000000000000000000000000000000
--- a/mojo/examples/pepper_container_app/pepper_container_app.cc
+++ /dev/null
@@ -1,130 +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/macros.h"
-#include "base/memory/ref_counted.h"
-#include "base/memory/scoped_ptr.h"
-#include "base/memory/weak_ptr.h"
-#include "base/message_loop/message_loop.h"
-#include "build/build_config.h"
-#include "mojo/application/application_runner_chromium.h"
-#include "mojo/examples/pepper_container_app/mojo_ppapi_globals.h"
-#include "mojo/examples/pepper_container_app/plugin_instance.h"
-#include "mojo/examples/pepper_container_app/plugin_module.h"
-#include "mojo/examples/pepper_container_app/type_converters.h"
-#include "mojo/public/c/system/main.h"
-#include "mojo/public/cpp/application/application_delegate.h"
-#include "mojo/public/cpp/application/application_impl.h"
-#include "mojo/public/cpp/system/core.h"
-#include "mojo/services/public/interfaces/geometry/geometry.mojom.h"
-#include "mojo/services/public/interfaces/gpu/gpu.mojom.h"
-#include "mojo/services/public/interfaces/native_viewport/native_viewport.mojom.h"
-#include "ppapi/c/pp_rect.h"
-#include "ppapi/shared_impl/proxy_lock.h"
-
-namespace mojo {
-namespace examples {
-
-class PepperContainerApp: public ApplicationDelegate,
- public NativeViewportClient,
- public MojoPpapiGlobals::Delegate {
- public:
- PepperContainerApp()
- : ppapi_globals_(this),
- plugin_module_(new PluginModule),
- weak_factory_(this) {}
-
- virtual ~PepperContainerApp() {}
-
- virtual void Initialize(ApplicationImpl* app) override {
- app->ConnectToService("mojo:native_viewport_service", &viewport_);
- viewport_.set_client(this);
-
- // TODO(jamesr): Should be mojo:gpu_service
- app->ConnectToService("mojo:native_viewport_service", &gpu_service_);
-
- SizePtr size(Size::New());
- size->width = 800;
- size->height = 600;
- viewport_->Create(size.Pass(),
- base::Bind(&PepperContainerApp::OnCreatedNativeViewport,
- weak_factory_.GetWeakPtr()));
- viewport_->Show();
- }
-
- // NativeViewportClient implementation.
- virtual void OnDestroyed() override {
- ppapi::ProxyAutoLock lock;
-
- if (plugin_instance_) {
- plugin_instance_->DidDestroy();
- plugin_instance_.reset();
- }
-
- base::MessageLoop::current()->Quit();
- }
-
- virtual void OnSizeChanged(SizePtr size) override {
- ppapi::ProxyAutoLock lock;
-
- if (plugin_instance_) {
- PP_Rect pp_rect = {{0, 0}, {size->width, size->height}};
- plugin_instance_->DidChangeView(pp_rect);
- }
- }
-
- virtual void OnEvent(EventPtr event,
- const mojo::Callback<void()>& callback) override {
- if (!event->location_data.is_null()) {
- ppapi::ProxyAutoLock lock;
-
- // TODO(yzshen): Handle events.
- }
- callback.Run();
- }
-
- // MojoPpapiGlobals::Delegate implementation.
- virtual ScopedMessagePipeHandle CreateGLES2Context() override {
- CommandBufferPtr command_buffer;
- SizePtr size = Size::New();
- size->width = 800;
- size->width = 600;
- // TODO(jamesr): Output a surface to the native viewport instead.
- gpu_service_->CreateOnscreenGLES2Context(
- native_viewport_id_, size.Pass(), GetProxy(&command_buffer));
- return command_buffer.PassMessagePipe();
- }
-
- private:
- void OnCreatedNativeViewport(uint64_t native_viewport_id) {
- native_viewport_id_ = native_viewport_id;
- ppapi::ProxyAutoLock lock;
-
- plugin_instance_ = plugin_module_->CreateInstance().Pass();
- if (!plugin_instance_->DidCreate())
- plugin_instance_.reset();
- }
-
- MojoPpapiGlobals ppapi_globals_;
-
- uint64_t native_viewport_id_;
- NativeViewportPtr viewport_;
- GpuPtr gpu_service_;
- scoped_refptr<PluginModule> plugin_module_;
- scoped_ptr<PluginInstance> plugin_instance_;
-
- base::WeakPtrFactory<PepperContainerApp> weak_factory_;
-
- DISALLOW_COPY_AND_ASSIGN(PepperContainerApp);
-};
-
-} // namespace examples
-} // namespace mojo
-
-MojoResult MojoMain(MojoHandle shell_handle) {
- mojo::ApplicationRunnerChromium runner(
- new mojo::examples::PepperContainerApp);
- return runner.Run(shell_handle);
-}
-
« no previous file with comments | « mojo/examples/pepper_container_app/mojo_ppapi_globals.cc ('k') | mojo/examples/pepper_container_app/plugin_instance.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698