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

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

Issue 1487123002: Platform Window: Fixing null checks. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressing feedback. Created 5 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
« no previous file with comments | « ui/platform_window/android/platform_ime_controller_android.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
55 PlatformWindowAndroid::PlatformWindowAndroid(PlatformWindowDelegate* delegate) 55 PlatformWindowAndroid::PlatformWindowAndroid(PlatformWindowDelegate* delegate)
56 : delegate_(delegate), 56 : delegate_(delegate),
57 window_(NULL), 57 window_(NULL),
58 id_generator_(0), 58 id_generator_(0),
59 weak_factory_(this) { 59 weak_factory_(this) {
60 } 60 }
61 61
62 PlatformWindowAndroid::~PlatformWindowAndroid() { 62 PlatformWindowAndroid::~PlatformWindowAndroid() {
63 if (window_) 63 if (window_)
64 ReleaseWindow(); 64 ReleaseWindow();
65 if (!java_platform_window_android_.is_empty()) { 65 JNIEnv* env = base::android::AttachCurrentThread();
66 JNIEnv* env = base::android::AttachCurrentThread(); 66 ScopedJavaLocalRef<jobject> scoped_obj =
67 Java_PlatformWindowAndroid_detach( 67 java_platform_window_android_.get(env);
68 env, java_platform_window_android_.get(env).obj()); 68 if (!scoped_obj.is_null()) {
69 Java_PlatformWindowAndroid_detach(env, scoped_obj.obj());
69 } 70 }
70 } 71 }
71 72
72 void PlatformWindowAndroid::Destroy(JNIEnv* env, jobject obj) { 73 void PlatformWindowAndroid::Destroy(JNIEnv* env, jobject obj) {
73 delegate_->OnClosed(); 74 delegate_->OnClosed();
74 } 75 }
75 76
76 void PlatformWindowAndroid::SurfaceCreated(JNIEnv* env, 77 void PlatformWindowAndroid::SurfaceCreated(JNIEnv* env,
77 jobject obj, 78 jobject obj,
78 jobject jsurface, 79 jobject jsurface,
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 218
218 void PlatformWindowAndroid::ConfineCursorToBounds(const gfx::Rect& bounds) { 219 void PlatformWindowAndroid::ConfineCursorToBounds(const gfx::Rect& bounds) {
219 NOTIMPLEMENTED(); 220 NOTIMPLEMENTED();
220 } 221 }
221 222
222 PlatformImeController* PlatformWindowAndroid::GetPlatformImeController() { 223 PlatformImeController* PlatformWindowAndroid::GetPlatformImeController() {
223 return &platform_ime_controller_; 224 return &platform_ime_controller_;
224 } 225 }
225 226
226 } // namespace ui 227 } // namespace ui
OLDNEW
« no previous file with comments | « ui/platform_window/android/platform_ime_controller_android.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698