OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "base/macros.h" | 5 #include "base/macros.h" |
6 #include "base/memory/ref_counted.h" | 6 #include "base/memory/ref_counted.h" |
7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
9 #include "build/build_config.h" | 9 #include "build/build_config.h" |
10 #include "mojo/examples/pepper_container_app/mojo_ppapi_globals.h" | 10 #include "mojo/examples/pepper_container_app/mojo_ppapi_globals.h" |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
83 base::MessageLoop::current()->Quit(); | 83 base::MessageLoop::current()->Quit(); |
84 } | 84 } |
85 | 85 |
86 virtual void OnBoundsChanged(const Rect& bounds) OVERRIDE { | 86 virtual void OnBoundsChanged(const Rect& bounds) OVERRIDE { |
87 ppapi::ProxyAutoLock lock; | 87 ppapi::ProxyAutoLock lock; |
88 | 88 |
89 if (plugin_instance_) | 89 if (plugin_instance_) |
90 plugin_instance_->DidChangeView(bounds); | 90 plugin_instance_->DidChangeView(bounds); |
91 } | 91 } |
92 | 92 |
93 virtual void OnEvent(const Event& event) OVERRIDE { | 93 virtual void OnEvent(const Event& event, |
94 const mojo::Callback<void()>& callback) OVERRIDE { | |
94 if (event.location().is_null()) | 95 if (event.location().is_null()) |
darin (slow to review)
2014/03/31 03:24:05
it might be good to leave a comment here checking
| |
95 return; | 96 return; |
96 | 97 |
97 { | 98 { |
98 ppapi::ProxyAutoLock lock; | 99 ppapi::ProxyAutoLock lock; |
99 | 100 |
100 // TODO(yzshen): Handle events. | 101 // TODO(yzshen): Handle events. |
101 } | 102 } |
102 viewport_->AckEvent(event); | 103 callback.Run(); |
103 } | 104 } |
104 | 105 |
105 // MojoPpapiGlobals::Delegate implementation. | 106 // MojoPpapiGlobals::Delegate implementation. |
106 virtual ScopedMessagePipeHandle CreateGLES2Context() OVERRIDE { | 107 virtual ScopedMessagePipeHandle CreateGLES2Context() OVERRIDE { |
107 MessagePipe gles2_pipe; | 108 MessagePipe gles2_pipe; |
108 viewport_->CreateGLES2Context(gles2_pipe.handle1.Pass()); | 109 viewport_->CreateGLES2Context(gles2_pipe.handle1.Pass()); |
109 return gles2_pipe.handle0.Pass(); | 110 return gles2_pipe.handle0.Pass(); |
110 } | 111 } |
111 | 112 |
112 private: | 113 private: |
(...skipping 12 matching lines...) Expand all Loading... | |
125 extern "C" PEPPER_CONTAINER_APP_EXPORT MojoResult CDECL MojoMain( | 126 extern "C" PEPPER_CONTAINER_APP_EXPORT MojoResult CDECL MojoMain( |
126 MojoHandle shell_handle) { | 127 MojoHandle shell_handle) { |
127 mojo::Environment env; | 128 mojo::Environment env; |
128 mojo::GLES2Initializer gles2; | 129 mojo::GLES2Initializer gles2; |
129 base::MessageLoop run_loop; | 130 base::MessageLoop run_loop; |
130 mojo::examples::PepperContainerApp app(shell_handle); | 131 mojo::examples::PepperContainerApp app(shell_handle); |
131 | 132 |
132 run_loop.Run(); | 133 run_loop.Run(); |
133 return MOJO_RESULT_OK; | 134 return MOJO_RESULT_OK; |
134 } | 135 } |
OLD | NEW |