| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include <stdio.h> | 5 #include <stdio.h> |
| 6 #include <string> | 6 #include <string> |
| 7 | 7 |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/message_loop/message_loop.h" | 9 #include "base/message_loop/message_loop.h" |
| 10 #include "mojo/examples/compositor_app/compositor_host.h" | 10 #include "mojo/examples/compositor_app/compositor_host.h" |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 } | 55 } |
| 56 | 56 |
| 57 virtual void OnDestroyed() OVERRIDE { | 57 virtual void OnDestroyed() OVERRIDE { |
| 58 base::MessageLoop::current()->Quit(); | 58 base::MessageLoop::current()->Quit(); |
| 59 } | 59 } |
| 60 | 60 |
| 61 virtual void OnBoundsChanged(const Rect& bounds) OVERRIDE { | 61 virtual void OnBoundsChanged(const Rect& bounds) OVERRIDE { |
| 62 host_->SetSize(bounds.size()); | 62 host_->SetSize(bounds.size()); |
| 63 } | 63 } |
| 64 | 64 |
| 65 virtual void OnEvent(const Event& event) OVERRIDE { | 65 virtual void OnEvent(const Event& event, |
| 66 if (!event.location().is_null()) { | 66 const mojo::Callback<void()>& callback) OVERRIDE { |
| 67 viewport_->AckEvent(event); | 67 callback.Run(); |
| 68 } | |
| 69 } | 68 } |
| 70 | 69 |
| 71 private: | 70 private: |
| 72 RemotePtr<NativeViewport> viewport_; | 71 RemotePtr<NativeViewport> viewport_; |
| 73 scoped_ptr<CompositorHost> host_; | 72 scoped_ptr<CompositorHost> host_; |
| 74 }; | 73 }; |
| 75 | 74 |
| 76 } // namespace examples | 75 } // namespace examples |
| 77 } // namespace mojo | 76 } // namespace mojo |
| 78 | 77 |
| 79 extern "C" SAMPLE_APP_EXPORT MojoResult CDECL MojoMain( | 78 extern "C" SAMPLE_APP_EXPORT MojoResult CDECL MojoMain( |
| 80 MojoHandle shell_handle) { | 79 MojoHandle shell_handle) { |
| 81 base::MessageLoop loop; | 80 base::MessageLoop loop; |
| 82 mojo::GLES2Initializer gles2; | 81 mojo::GLES2Initializer gles2; |
| 83 | 82 |
| 84 mojo::examples::SampleApp app(shell_handle); | 83 mojo::examples::SampleApp app(shell_handle); |
| 85 loop.Run(); | 84 loop.Run(); |
| 86 return MOJO_RESULT_OK; | 85 return MOJO_RESULT_OK; |
| 87 } | 86 } |
| OLD | NEW |