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 "mojo/examples/sample_app/native_viewport_client_impl.h" | 5 #include "mojo/examples/sample_app/native_viewport_client_impl.h" |
6 | 6 |
7 #include <stdio.h> | 7 #include <stdio.h> |
8 | 8 |
| 9 #include "base/logging.h" |
| 10 |
9 namespace mojo { | 11 namespace mojo { |
10 namespace examples { | 12 namespace examples { |
11 | 13 |
12 NativeViewportClientImpl::NativeViewportClientImpl(ScopedMessagePipeHandle pipe) | 14 NativeViewportClientImpl::NativeViewportClientImpl(ScopedMessagePipeHandle pipe) |
13 : service_(pipe.Pass()) { | 15 : service_(pipe.Pass()) { |
14 service_.SetPeer(this); | 16 service_.SetPeer(this); |
15 } | 17 } |
16 | 18 |
17 NativeViewportClientImpl::~NativeViewportClientImpl() { | 19 NativeViewportClientImpl::~NativeViewportClientImpl() { |
18 service_->Close(); | 20 service_->Close(); |
19 } | 21 } |
20 | 22 |
21 void NativeViewportClientImpl::Open() { | 23 void NativeViewportClientImpl::Open() { |
22 service_->Open(); | 24 service_->Open(); |
23 | 25 |
24 ScopedMessagePipeHandle gles2; | 26 ScopedMessagePipeHandle gles2; |
25 ScopedMessagePipeHandle gles2_client; | 27 ScopedMessagePipeHandle gles2_client; |
26 CreateMessagePipe(&gles2, &gles2_client); | 28 CreateMessagePipe(&gles2, &gles2_client); |
27 | 29 |
28 gles2_client_.reset(new GLES2ClientImpl(gles2.Pass())); | 30 gles2_client_.reset(new GLES2ClientImpl(gles2.Pass())); |
29 service_->CreateGLES2Context(gles2_client.Pass()); | 31 service_->CreateGLES2Context(gles2_client.Pass()); |
30 } | 32 } |
31 | 33 |
32 void NativeViewportClientImpl::DidOpen() { | 34 void NativeViewportClientImpl::DidOpen() { |
33 } | 35 } |
34 | 36 |
| 37 void NativeViewportClientImpl::HandleEvent(const Event& event) { |
| 38 if (!event.location().is_null()) { |
| 39 LOG(INFO) << "Located Event @" |
| 40 << event.location().x() << "," << event.location().y(); |
| 41 } |
| 42 } |
| 43 |
35 } // namespace examples | 44 } // namespace examples |
36 } // namespace mojo | 45 } // namespace mojo |
OLD | NEW |