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/cpp/application/application_connection.h" | 9 #include "mojo/public/cpp/application/application_connection.h" |
10 #include "mojo/public/cpp/application/application_delegate.h" | 10 #include "mojo/public/cpp/application/application_delegate.h" |
11 #include "mojo/public/cpp/application/application_impl.h" | 11 #include "mojo/public/cpp/application/application_impl.h" |
12 #include "mojo/public/cpp/gles2/gles2.h" | |
13 #include "mojo/public/cpp/system/core.h" | 12 #include "mojo/public/cpp/system/core.h" |
14 #include "mojo/public/cpp/system/macros.h" | 13 #include "mojo/public/cpp/system/macros.h" |
15 #include "mojo/public/cpp/utility/run_loop.h" | 14 #include "mojo/public/cpp/utility/run_loop.h" |
16 #include "mojo/services/public/interfaces/native_viewport/native_viewport.mojom.
h" | 15 #include "mojo/services/public/interfaces/native_viewport/native_viewport.mojom.
h" |
17 | 16 |
18 namespace examples { | 17 namespace examples { |
19 | 18 |
20 class SampleApp : public mojo::ApplicationDelegate, | 19 class SampleApp : public mojo::ApplicationDelegate, |
21 public mojo::NativeViewportClient { | 20 public mojo::NativeViewportClient { |
22 public: | 21 public: |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 | 62 |
64 virtual void OnEvent(mojo::EventPtr event, | 63 virtual void OnEvent(mojo::EventPtr event, |
65 const mojo::Callback<void()>& callback) MOJO_OVERRIDE { | 64 const mojo::Callback<void()>& callback) MOJO_OVERRIDE { |
66 assert(event); | 65 assert(event); |
67 if (event->location) | 66 if (event->location) |
68 gles2_client_->HandleInputEvent(*event); | 67 gles2_client_->HandleInputEvent(*event); |
69 callback.Run(); | 68 callback.Run(); |
70 } | 69 } |
71 | 70 |
72 private: | 71 private: |
73 mojo::GLES2Initializer gles2; | |
74 scoped_ptr<GLES2ClientImpl> gles2_client_; | 72 scoped_ptr<GLES2ClientImpl> gles2_client_; |
75 mojo::NativeViewportPtr viewport_; | 73 mojo::NativeViewportPtr viewport_; |
76 | 74 |
77 DISALLOW_COPY_AND_ASSIGN(SampleApp); | 75 DISALLOW_COPY_AND_ASSIGN(SampleApp); |
78 }; | 76 }; |
79 | 77 |
80 } // namespace examples | 78 } // namespace examples |
81 | 79 |
82 namespace mojo { | 80 namespace mojo { |
83 | 81 |
84 // static | 82 // static |
85 ApplicationDelegate* ApplicationDelegate::Create() { | 83 ApplicationDelegate* ApplicationDelegate::Create() { |
86 return new examples::SampleApp(); | 84 return new examples::SampleApp(); |
87 } | 85 } |
88 | 86 |
89 } // namespace mojo | 87 } // namespace mojo |
OLD | NEW |