diff options
author | ben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-01-27 22:38:19 +0000 |
---|---|---|
committer | ben@chromium.org <ben@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-01-27 22:38:19 +0000 |
commit | bddb284378bf20a235f88261f5cef59248a0fdda (patch) | |
tree | 5e0616ccabad947af9ef898171ddc461d3a77a1e /mojo/examples/compositor_app | |
parent | 8f585c8a99e6514a3869b590ba8e881beec8dc52 (diff) | |
download | chromium_src-bddb284378bf20a235f88261f5cef59248a0fdda.zip chromium_src-bddb284378bf20a235f88261f5cef59248a0fdda.tar.gz chromium_src-bddb284378bf20a235f88261f5cef59248a0fdda.tar.bz2 |
Add a Launcher App.
To get this to work somewhat well, I had to add a bunch of stuff to NativeViewport. It's still very glitchy. I'll fix that later.
BUG=
R=sky@chromium.org
Review URL: https://codereview.chromium.org/145623005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@247329 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'mojo/examples/compositor_app')
-rw-r--r-- | mojo/examples/compositor_app/compositor_app.cc | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/mojo/examples/compositor_app/compositor_app.cc b/mojo/examples/compositor_app/compositor_app.cc index a4e1182..1e7cb66 100644 --- a/mojo/examples/compositor_app/compositor_app.cc +++ b/mojo/examples/compositor_app/compositor_app.cc @@ -12,8 +12,10 @@ #include "mojo/public/gles2/gles2_cpp.h" #include "mojo/public/system/core.h" #include "mojo/public/system/macros.h" +#include "mojo/services/native_viewport/geometry_conversions.h" #include "mojom/native_viewport.h" #include "mojom/shell.h" +#include "ui/gfx/rect.h" #if defined(WIN32) #if !defined(CDECL) @@ -32,11 +34,11 @@ class SampleApp : public ShellClient { public: explicit SampleApp(ScopedMessagePipeHandle shell_handle) : shell_(shell_handle.Pass(), this) { - mojo::ScopedMessagePipeHandle client_handle, native_viewport_handle; + ScopedMessagePipeHandle client_handle, native_viewport_handle; CreateMessagePipe(&client_handle, &native_viewport_handle); native_viewport_client_.reset( new NativeViewportClientImpl(native_viewport_handle.Pass())); - mojo::AllocationScope scope; + AllocationScope scope; shell_->Connect("mojo:mojo_native_viewport_service", client_handle.Pass()); } @@ -45,11 +47,12 @@ class SampleApp : public ShellClient { } private: - class NativeViewportClientImpl : public mojo::NativeViewportClient { + class NativeViewportClientImpl : public NativeViewportClient { public: explicit NativeViewportClientImpl(ScopedMessagePipeHandle viewport_handle) : viewport_(viewport_handle.Pass(), this) { - viewport_->Open(); + viewport_->Create(gfx::Rect(10, 10, 800, 600)); + viewport_->Show(); ScopedMessagePipeHandle gles2_handle; ScopedMessagePipeHandle gles2_client_handle; CreateMessagePipe(&gles2_handle, &gles2_client_handle); @@ -75,6 +78,9 @@ class SampleApp : public ShellClient { base::MessageLoop::current()->Quit(); } + virtual void OnBoundsChanged(const Rect& bounds) MOJO_OVERRIDE { + } + virtual void OnEvent(const Event& event) MOJO_OVERRIDE { if (!event.location().is_null()) { viewport_->AckEvent(event); @@ -86,7 +92,7 @@ class SampleApp : public ShellClient { RemotePtr<NativeViewport> viewport_; scoped_ptr<CompositorHost> host_; }; - mojo::RemotePtr<Shell> shell_; + RemotePtr<Shell> shell_; scoped_ptr<NativeViewportClientImpl> native_viewport_client_; }; |