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

Side by Side Diff: ui/platform_window/android/platform_window_android.cc

Issue 2431753002: Mus experiment in content shell on Android.
Patch Set: Fix mac bot Created 4 years, 1 month 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
OLDNEW
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" 10 #include "base/android/context_utils.h"
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 // PlatformWindowAndroid, public: 51 // PlatformWindowAndroid, public:
52 52
53 // static 53 // static
54 bool PlatformWindowAndroid::Register(JNIEnv* env) { 54 bool PlatformWindowAndroid::Register(JNIEnv* env) {
55 return RegisterNativesImpl(env); 55 return RegisterNativesImpl(env);
56 } 56 }
57 57
58 PlatformWindowAndroid::PlatformWindowAndroid(PlatformWindowDelegate* delegate) 58 PlatformWindowAndroid::PlatformWindowAndroid(PlatformWindowDelegate* delegate)
59 : delegate_(delegate), 59 : delegate_(delegate),
60 window_(NULL), 60 window_(NULL),
61 id_generator_(0), 61 id_generator_(0) {
62 weak_factory_(this) {
63 } 62 }
64 63
65 PlatformWindowAndroid::~PlatformWindowAndroid() { 64 PlatformWindowAndroid::~PlatformWindowAndroid() {
66 if (window_) 65 if (window_)
67 ReleaseWindow(); 66 ReleaseWindow();
68 JNIEnv* env = base::android::AttachCurrentThread(); 67 JNIEnv* env = base::android::AttachCurrentThread();
69 ScopedJavaLocalRef<jobject> scoped_obj = 68 ScopedJavaLocalRef<jobject> scoped_obj =
70 java_platform_window_android_.get(env); 69 java_platform_window_android_.get(env);
71 if (!scoped_obj.is_null()) { 70 if (!scoped_obj.is_null()) {
72 Java_PlatformWindowAndroid_detach(env, scoped_obj); 71 Java_PlatformWindowAndroid_detach(env, scoped_obj);
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 } 156 }
158 157
159 //////////////////////////////////////////////////////////////////////////////// 158 ////////////////////////////////////////////////////////////////////////////////
160 // PlatformWindowAndroid, PlatformWindow implementation: 159 // PlatformWindowAndroid, PlatformWindow implementation:
161 160
162 void PlatformWindowAndroid::Show() { 161 void PlatformWindowAndroid::Show() {
163 if (!java_platform_window_android_.is_empty()) 162 if (!java_platform_window_android_.is_empty())
164 return; 163 return;
165 JNIEnv* env = base::android::AttachCurrentThread(); 164 JNIEnv* env = base::android::AttachCurrentThread();
166 java_platform_window_android_ = JavaObjectWeakGlobalRef( 165 java_platform_window_android_ = JavaObjectWeakGlobalRef(
167 env, Java_PlatformWindowAndroid_createForActivity( 166 env, Java_PlatformWindowAndroid_createForCurrentActivity(
168 env, base::android::GetApplicationContext(), 167 env,
169 reinterpret_cast<jlong>(this), 168 reinterpret_cast<jlong>(this),
170 reinterpret_cast<jlong>(&platform_ime_controller_)).obj()); 169 reinterpret_cast<jlong>(&platform_ime_controller_)).obj());
171 } 170 }
172 171
173 void PlatformWindowAndroid::Hide() { 172 void PlatformWindowAndroid::Hide() {
174 // Nothing to do. View is always visible. 173 // Nothing to do. View is always visible.
175 } 174 }
176 175
177 void PlatformWindowAndroid::Close() { 176 void PlatformWindowAndroid::Close() {
178 delegate_->OnCloseRequest(); 177 delegate_->OnCloseRequest();
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 223
225 void PlatformWindowAndroid::ConfineCursorToBounds(const gfx::Rect& bounds) { 224 void PlatformWindowAndroid::ConfineCursorToBounds(const gfx::Rect& bounds) {
226 NOTIMPLEMENTED(); 225 NOTIMPLEMENTED();
227 } 226 }
228 227
229 PlatformImeController* PlatformWindowAndroid::GetPlatformImeController() { 228 PlatformImeController* PlatformWindowAndroid::GetPlatformImeController() {
230 return &platform_ime_controller_; 229 return &platform_ime_controller_;
231 } 230 }
232 231
233 } // namespace ui 232 } // namespace ui
OLDNEW
« no previous file with comments | « ui/platform_window/android/platform_window_android.h ('k') | ui/platform_window/platform_window.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698