OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "ui/platform_window/android/platform_window_android.h" | 5 #include "ui/platform_window/android/platform_window_android.h" |
6 | 6 |
7 #include <android/input.h> | 7 #include <android/input.h> |
8 #include <android/native_window_jni.h> | 8 #include <android/native_window_jni.h> |
9 | 9 |
10 #include "base/android/context_utils.h" | |
11 #include "base/android/jni_android.h" | 10 #include "base/android/jni_android.h" |
12 #include "jni/PlatformWindowAndroid_jni.h" | 11 #include "jni/PlatformWindowAndroid_jni.h" |
13 #include "ui/events/event.h" | 12 #include "ui/events/event.h" |
14 #include "ui/events/keycodes/keyboard_code_conversion_android.h" | 13 #include "ui/events/keycodes/keyboard_code_conversion_android.h" |
15 #include "ui/gfx/geometry/point.h" | 14 #include "ui/gfx/geometry/point.h" |
16 #include "ui/platform_window/platform_window_delegate.h" | 15 #include "ui/platform_window/platform_window_delegate.h" |
17 | 16 |
18 using base::android::JavaParamRef; | 17 using base::android::JavaParamRef; |
19 using base::android::ScopedJavaLocalRef; | 18 using base::android::ScopedJavaLocalRef; |
20 | 19 |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 | 159 |
161 //////////////////////////////////////////////////////////////////////////////// | 160 //////////////////////////////////////////////////////////////////////////////// |
162 // PlatformWindowAndroid, PlatformWindow implementation: | 161 // PlatformWindowAndroid, PlatformWindow implementation: |
163 | 162 |
164 void PlatformWindowAndroid::Show() { | 163 void PlatformWindowAndroid::Show() { |
165 if (!java_platform_window_android_.is_uninitialized()) | 164 if (!java_platform_window_android_.is_uninitialized()) |
166 return; | 165 return; |
167 JNIEnv* env = base::android::AttachCurrentThread(); | 166 JNIEnv* env = base::android::AttachCurrentThread(); |
168 java_platform_window_android_ = JavaObjectWeakGlobalRef( | 167 java_platform_window_android_ = JavaObjectWeakGlobalRef( |
169 env, Java_PlatformWindowAndroid_createForActivity( | 168 env, Java_PlatformWindowAndroid_createForActivity( |
170 env, base::android::GetApplicationContext(), | 169 env, reinterpret_cast<jlong>(this), |
171 reinterpret_cast<jlong>(this), | 170 reinterpret_cast<jlong>(&platform_ime_controller_)) |
172 reinterpret_cast<jlong>(&platform_ime_controller_)).obj()); | 171 .obj()); |
173 } | 172 } |
174 | 173 |
175 void PlatformWindowAndroid::Hide() { | 174 void PlatformWindowAndroid::Hide() { |
176 // Nothing to do. View is always visible. | 175 // Nothing to do. View is always visible. |
177 } | 176 } |
178 | 177 |
179 void PlatformWindowAndroid::Close() { | 178 void PlatformWindowAndroid::Close() { |
180 delegate_->OnCloseRequest(); | 179 delegate_->OnCloseRequest(); |
181 } | 180 } |
182 | 181 |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
228 | 227 |
229 void PlatformWindowAndroid::ConfineCursorToBounds(const gfx::Rect& bounds) { | 228 void PlatformWindowAndroid::ConfineCursorToBounds(const gfx::Rect& bounds) { |
230 NOTIMPLEMENTED(); | 229 NOTIMPLEMENTED(); |
231 } | 230 } |
232 | 231 |
233 PlatformImeController* PlatformWindowAndroid::GetPlatformImeController() { | 232 PlatformImeController* PlatformWindowAndroid::GetPlatformImeController() { |
234 return &platform_ime_controller_; | 233 return &platform_ime_controller_; |
235 } | 234 } |
236 | 235 |
237 } // namespace ui | 236 } // namespace ui |
OLD | NEW |