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 "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 17 matching lines...) Expand all Loading... |
28 #endif | 28 #endif |
29 | 29 |
30 namespace mojo { | 30 namespace mojo { |
31 namespace examples { | 31 namespace examples { |
32 | 32 |
33 class SampleApp : public Application, public mojo::NativeViewportClient { | 33 class SampleApp : public Application, public mojo::NativeViewportClient { |
34 public: | 34 public: |
35 explicit SampleApp(MojoHandle shell_handle) : Application(shell_handle) { | 35 explicit SampleApp(MojoHandle shell_handle) : Application(shell_handle) { |
36 InterfacePipe<NativeViewport, AnyInterface> viewport_pipe; | 36 InterfacePipe<NativeViewport, AnyInterface> viewport_pipe; |
37 mojo::AllocationScope scope; | 37 mojo::AllocationScope scope; |
38 GetShell()->Connect("mojo:mojo_native_viewport_service", | 38 shell()->Connect("mojo:mojo_native_viewport_service", |
39 viewport_pipe.handle_to_peer.Pass()); | 39 viewport_pipe.handle_to_peer.Pass()); |
40 viewport_.reset(viewport_pipe.handle_to_self.Pass(), this); | 40 viewport_.reset(viewport_pipe.handle_to_self.Pass(), this); |
41 Rect::Builder rect; | 41 Rect::Builder rect; |
42 Point::Builder point; | 42 Point::Builder point; |
43 point.set_x(10); | 43 point.set_x(10); |
44 point.set_y(10); | 44 point.set_y(10); |
45 rect.set_position(point.Finish()); | 45 rect.set_position(point.Finish()); |
46 Size::Builder size; | 46 Size::Builder size; |
47 size.set_width(800); | 47 size.set_width(800); |
48 size.set_height(600); | 48 size.set_height(600); |
49 rect.set_size(size.Finish()); | 49 rect.set_size(size.Finish()); |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 } |
OLD | NEW |