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_android.h" | 5 #include "mojo/services/native_viewport/native_viewport_android.h" |
6 | 6 |
7 #include <android/native_window_jni.h> | 7 #include <android/native_window_jni.h> |
8 #include "mojo/services/native_viewport/android/mojo_viewport.h" | 8 #include "mojo/services/native_viewport/android/mojo_viewport.h" |
9 #include "mojo/shell/context.h" | 9 #include "mojo/shell/context.h" |
10 #include "ui/events/event.h" | 10 #include "ui/events/event.h" |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 | 64 |
65 gfx::Size NativeViewportAndroid::GetSize() { | 65 gfx::Size NativeViewportAndroid::GetSize() { |
66 return size_; | 66 return size_; |
67 } | 67 } |
68 | 68 |
69 void NativeViewportAndroid::Init() { | 69 void NativeViewportAndroid::Init() { |
70 MojoViewportInit* init = new MojoViewportInit(); | 70 MojoViewportInit* init = new MojoViewportInit(); |
71 init->ui_runner = context_->task_runners()->ui_runner(); | 71 init->ui_runner = context_->task_runners()->ui_runner(); |
72 init->native_viewport = GetWeakPtr(); | 72 init->native_viewport = GetWeakPtr(); |
73 | 73 |
74 context_->task_runners()->java_runner()->PostTask(FROM_HERE, | 74 MojoViewport::CreateForActivity(context_->activity(), init); |
75 base::Bind(MojoViewport::CreateForActivity, | |
76 context_->activity(), | |
77 init)); | |
78 } | 75 } |
79 | 76 |
80 void NativeViewportAndroid::Close() { | 77 void NativeViewportAndroid::Close() { |
81 // TODO(beng): close activity containing MojoView? | 78 // TODO(beng): close activity containing MojoView? |
82 | 79 |
83 // TODO(beng): perform this in response to view destruction. | 80 // TODO(beng): perform this in response to view destruction. |
84 delegate_->OnDestroyed(); | 81 delegate_->OnDestroyed(); |
85 } | 82 } |
86 | 83 |
87 // static | 84 // static |
88 scoped_ptr<NativeViewport> NativeViewport::Create( | 85 scoped_ptr<NativeViewport> NativeViewport::Create( |
89 shell::Context* context, | 86 shell::Context* context, |
90 NativeViewportDelegate* delegate) { | 87 NativeViewportDelegate* delegate) { |
91 return scoped_ptr<NativeViewport>( | 88 return scoped_ptr<NativeViewport>( |
92 new NativeViewportAndroid(context, delegate)).Pass(); | 89 new NativeViewportAndroid(context, delegate)).Pass(); |
93 } | 90 } |
94 | 91 |
95 } // namespace services | 92 } // namespace services |
96 } // namespace mojo | 93 } // namespace mojo |
OLD | NEW |