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

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

Issue 93793009: Implement ServiceManager (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Allow Android to be built Created 7 years 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "mojo/examples/sample_app/native_viewport_client_impl.h"
6
7 #include <stdio.h>
8
9 #include "base/logging.h"
10 #include "base/message_loop/message_loop.h"
11
12 namespace mojo {
13 namespace examples {
14
15 NativeViewportClientImpl::NativeViewportClientImpl(ScopedMessagePipeHandle pipe)
16 : service_(pipe.Pass()) {
17 service_.SetPeer(this);
18 }
19
20 NativeViewportClientImpl::~NativeViewportClientImpl() {
21 service_->Close();
22 }
23
24 void NativeViewportClientImpl::Open() {
25 service_->Open();
26
27 ScopedMessagePipeHandle gles2;
28 ScopedMessagePipeHandle gles2_client;
29 CreateMessagePipe(&gles2, &gles2_client);
30
31 gles2_client_.reset(new GLES2ClientImpl(gles2.Pass()));
32 service_->CreateGLES2Context(gles2_client.Pass());
33 }
34
35 void NativeViewportClientImpl::OnCreated() {
36 }
37
38 void NativeViewportClientImpl::OnDestroyed() {
39 base::MessageLoop::current()->Quit();
40 }
41
42 void NativeViewportClientImpl::OnEvent(const Event& event) {
43 if (!event.location().is_null()) {
44 gles2_client_->HandleInputEvent(event);
45 service_->AckEvent(event);
46 }
47 }
48
49 } // namespace examples
50 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/examples/sample_app/native_viewport_client_impl.h ('k') | mojo/examples/sample_app/sample_app.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698