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

Side by Side Diff: content/browser/android/content_view_core_impl.cc

Issue 2426083002: Clean up other instances where Tab WindowAndroid was being set to null. (Closed)
Patch Set: Rebase 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
« no previous file with comments | « chrome/android/java/src/org/chromium/chrome/browser/vr_shell/VrShellImpl.java ('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 2012 The Chromium Authors. All rights reserved. 1 // Copyright 2012 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 "content/browser/android/content_view_core_impl.h" 5 #include "content/browser/android/content_view_core_impl.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/android/jni_android.h" 9 #include "base/android/jni_android.h"
10 #include "base/android/jni_array.h" 10 #include "base/android/jni_array.h"
(...skipping 249 matching lines...) Expand 10 before | Expand all | Expand 10 after
260 Java_ContentViewCore_onNativeContentViewCoreDestroyed( 260 Java_ContentViewCore_onNativeContentViewCoreDestroyed(
261 env, j_obj, reinterpret_cast<intptr_t>(this)); 261 env, j_obj, reinterpret_cast<intptr_t>(this));
262 } 262 }
263 } 263 }
264 264
265 void ContentViewCoreImpl::UpdateWindowAndroid( 265 void ContentViewCoreImpl::UpdateWindowAndroid(
266 JNIEnv* env, 266 JNIEnv* env,
267 const base::android::JavaParamRef<jobject>& obj, 267 const base::android::JavaParamRef<jobject>& obj,
268 jlong window_android) { 268 jlong window_android) {
269 ui::ViewAndroid* view = GetViewAndroid(); 269 ui::ViewAndroid* view = GetViewAndroid();
270 if (window_android) { 270 ui::WindowAndroid* window =
271 DCHECK(!GetWindowAndroid()); 271 reinterpret_cast<ui::WindowAndroid*>(window_android);
272 ui::WindowAndroid* window = 272 if (window == GetWindowAndroid())
273 reinterpret_cast<ui::WindowAndroid*>(window_android); 273 return;
274 window->AddChild(view); 274 if (GetWindowAndroid()) {
275 for (auto& observer : observer_list_)
276 observer.OnAttachedToWindow();
277 } else {
278 for (auto& observer : observer_list_) 275 for (auto& observer : observer_list_)
279 observer.OnDetachedFromWindow(); 276 observer.OnDetachedFromWindow();
280 view->RemoveFromParent(); 277 view->RemoveFromParent();
281 } 278 }
279 if (window) {
280 window->AddChild(view);
281 for (auto& observer : observer_list_)
282 observer.OnAttachedToWindow();
283 }
282 } 284 }
283 285
284 base::android::ScopedJavaLocalRef<jobject> 286 base::android::ScopedJavaLocalRef<jobject>
285 ContentViewCoreImpl::GetWebContentsAndroid(JNIEnv* env, 287 ContentViewCoreImpl::GetWebContentsAndroid(JNIEnv* env,
286 const JavaParamRef<jobject>& obj) { 288 const JavaParamRef<jobject>& obj) {
287 return web_contents_->GetJavaWebContents(); 289 return web_contents_->GetJavaWebContents();
288 } 290 }
289 291
290 base::android::ScopedJavaLocalRef<jobject> 292 base::android::ScopedJavaLocalRef<jobject>
291 ContentViewCoreImpl::GetJavaWindowAndroid(JNIEnv* env, 293 ContentViewCoreImpl::GetJavaWindowAndroid(JNIEnv* env,
(...skipping 1277 matching lines...) Expand 10 before | Expand all | Expand 10 after
1569 return ScopedJavaLocalRef<jobject>(); 1571 return ScopedJavaLocalRef<jobject>();
1570 1572
1571 return view->GetJavaObject(); 1573 return view->GetJavaObject();
1572 } 1574 }
1573 1575
1574 bool RegisterContentViewCore(JNIEnv* env) { 1576 bool RegisterContentViewCore(JNIEnv* env) {
1575 return RegisterNativesImpl(env); 1577 return RegisterNativesImpl(env);
1576 } 1578 }
1577 1579
1578 } // namespace content 1580 } // namespace content
OLDNEW
« no previous file with comments | « chrome/android/java/src/org/chromium/chrome/browser/vr_shell/VrShellImpl.java ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698