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

Side by Side Diff: mojo/examples/sample_app/sample_app.cc

Issue 218763002: Change AckEvent into request / response (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix early return Created 6 years, 8 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 "mojo/examples/sample_app/gles2_client_impl.h" 8 #include "mojo/examples/sample_app/gles2_client_impl.h"
9 #include "mojo/public/bindings/allocation_scope.h" 9 #include "mojo/public/bindings/allocation_scope.h"
10 #include "mojo/public/bindings/remote_ptr.h" 10 #include "mojo/public/bindings/remote_ptr.h"
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 } 64 }
65 65
66 virtual void OnDestroyed() MOJO_OVERRIDE { 66 virtual void OnDestroyed() MOJO_OVERRIDE {
67 RunLoop::current()->Quit(); 67 RunLoop::current()->Quit();
68 } 68 }
69 69
70 virtual void OnBoundsChanged(const Rect& bounds) MOJO_OVERRIDE { 70 virtual void OnBoundsChanged(const Rect& bounds) MOJO_OVERRIDE {
71 gles2_client_->SetSize(bounds.size()); 71 gles2_client_->SetSize(bounds.size());
72 } 72 }
73 73
74 virtual void OnEvent(const Event& event) MOJO_OVERRIDE { 74 virtual void OnEvent(const Event& event,
75 if (!event.location().is_null()) { 75 const mojo::Callback<void()>& callback) MOJO_OVERRIDE {
76 if (!event.location().is_null())
76 gles2_client_->HandleInputEvent(event); 77 gles2_client_->HandleInputEvent(event);
77 viewport_->AckEvent(event); 78 callback.Run();
78 }
79 } 79 }
80 80
81 private: 81 private:
82 scoped_ptr<GLES2ClientImpl> gles2_client_; 82 scoped_ptr<GLES2ClientImpl> gles2_client_;
83 RemotePtr<NativeViewport> viewport_; 83 RemotePtr<NativeViewport> viewport_;
84 }; 84 };
85 85
86 } // namespace examples 86 } // namespace examples
87 } // namespace mojo 87 } // namespace mojo
88 88
89 extern "C" SAMPLE_APP_EXPORT MojoResult CDECL MojoMain( 89 extern "C" SAMPLE_APP_EXPORT MojoResult CDECL MojoMain(
90 MojoHandle shell_handle) { 90 MojoHandle shell_handle) {
91 mojo::Environment env; 91 mojo::Environment env;
92 mojo::RunLoop loop; 92 mojo::RunLoop loop;
93 mojo::GLES2Initializer gles2; 93 mojo::GLES2Initializer gles2;
94 94
95 mojo::examples::SampleApp app(shell_handle); 95 mojo::examples::SampleApp app(shell_handle);
96 loop.Run(); 96 loop.Run();
97 return MOJO_RESULT_OK; 97 return MOJO_RESULT_OK;
98 } 98 }
OLDNEW
« no previous file with comments | « mojo/examples/pepper_container_app/pepper_container_app.cc ('k') | mojo/examples/view_manager/view_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698