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/services/native_viewport/native_viewport_controller.h" | 5 #include "mojo/services/native_viewport/native_viewport_controller.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
10 #include "gpu/command_buffer/client/gl_in_process_context.h" | 10 #include "gpu/command_buffer/client/gl_in_process_context.h" |
11 #include "gpu/command_buffer/client/gles2_implementation.h" | 11 #include "gpu/command_buffer/client/gles2_implementation.h" |
12 #include "mojo/services/native_viewport/native_viewport.h" | 12 #include "mojo/services/native_viewport/native_viewport.h" |
13 #include "ui/events/event.h" | 13 #include "ui/events/event.h" |
14 | 14 |
15 namespace mojo { | 15 namespace mojo { |
16 namespace services { | 16 namespace services { |
17 | 17 |
18 NativeViewportController::NativeViewportController( | 18 NativeViewportController::NativeViewportController( |
19 shell::Context* context, Handle pipe) | 19 shell::Context* context, Handle pipe) |
20 : pipe_(pipe) { | 20 : pipe_(pipe) { |
21 native_viewport_ = NativeViewport::Create(context, this); | 21 native_viewport_ = NativeViewport::Create(context, this); |
| 22 native_viewport_->Init(); |
22 } | 23 } |
| 24 |
23 NativeViewportController::~NativeViewportController() { | 25 NativeViewportController::~NativeViewportController() { |
24 } | 26 } |
25 | 27 |
26 void NativeViewportController::Close() { | 28 void NativeViewportController::Close() { |
27 DCHECK(native_viewport_); | 29 DCHECK(native_viewport_); |
28 native_viewport_->Close(); | 30 native_viewport_->Close(); |
29 } | 31 } |
30 | 32 |
31 bool NativeViewportController::OnEvent(ui::Event* event) { | 33 bool NativeViewportController::OnEvent(ui::Event* event) { |
32 ui::LocatedEvent* located = static_cast<ui::LocatedEvent*>(event); | 34 ui::LocatedEvent* located = static_cast<ui::LocatedEvent*>(event); |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 base::MessageLoop::current()->Quit(); | 69 base::MessageLoop::current()->Quit(); |
68 } | 70 } |
69 | 71 |
70 void NativeViewportController::SendString(const std::string& string) { | 72 void NativeViewportController::SendString(const std::string& string) { |
71 WriteMessage(pipe_, string.c_str(), string.size()+1, NULL, 0, | 73 WriteMessage(pipe_, string.c_str(), string.size()+1, NULL, 0, |
72 MOJO_WRITE_MESSAGE_FLAG_NONE); | 74 MOJO_WRITE_MESSAGE_FLAG_NONE); |
73 } | 75 } |
74 | 76 |
75 } // namespace services | 77 } // namespace services |
76 } // namespace mojo | 78 } // namespace mojo |
OLD | NEW |