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

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

Issue 133073012: android: Fix ContentViewCore and RenderWidgetHostViewAndroid lifetime issue (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: ContentViewCoreImpl is already a WebContentsObserver Created 6 years, 11 months 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 | « content/browser/android/content_view_core_impl.h ('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 "base/android/jni_android.h" 7 #include "base/android/jni_android.h"
8 #include "base/android/jni_array.h" 8 #include "base/android/jni_array.h"
9 #include "base/android/jni_string.h" 9 #include "base/android/jni_string.h"
10 #include "base/android/scoped_java_ref.h" 10 #include "base/android/scoped_java_ref.h"
(...skipping 1661 matching lines...) Expand 10 before | Expand all | Expand 10 after
1672 const base::string16& result) { 1672 const base::string16& result) {
1673 JNIEnv* env = AttachCurrentThread(); 1673 JNIEnv* env = AttachCurrentThread();
1674 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env); 1674 ScopedJavaLocalRef<jobject> obj = java_ref_.get(env);
1675 if (obj.is_null()) 1675 if (obj.is_null())
1676 return; 1676 return;
1677 ScopedJavaLocalRef<jstring> jresult = ConvertUTF16ToJavaString(env, result); 1677 ScopedJavaLocalRef<jstring> jresult = ConvertUTF16ToJavaString(env, result);
1678 Java_ContentViewCore_onSmartClipDataExtracted( 1678 Java_ContentViewCore_onSmartClipDataExtracted(
1679 env, obj.obj(), jresult.obj()); 1679 env, obj.obj(), jresult.obj());
1680 } 1680 }
1681 1681
1682 void ContentViewCoreImpl::WebContentsDestroyed(WebContents* web_contents) {
1683 WebContentsViewAndroid* wcva =
1684 static_cast<WebContentsViewAndroid*>(web_contents->GetView());
1685 DCHECK(wcva);
1686 wcva->SetContentViewCore(NULL);
1687 }
1688
1682 // This is called for each ContentView. 1689 // This is called for each ContentView.
1683 jlong Init(JNIEnv* env, jobject obj, 1690 jlong Init(JNIEnv* env, jobject obj,
1684 jboolean hardware_accelerated, 1691 jboolean hardware_accelerated,
1685 jlong native_web_contents, 1692 jlong native_web_contents,
1686 jlong view_android, 1693 jlong view_android,
1687 jlong window_android) { 1694 jlong window_android) {
1688 ContentViewCoreImpl* view = new ContentViewCoreImpl( 1695 ContentViewCoreImpl* view = new ContentViewCoreImpl(
1689 env, obj, hardware_accelerated, 1696 env, obj, hardware_accelerated,
1690 reinterpret_cast<WebContents*>(native_web_contents), 1697 reinterpret_cast<WebContents*>(native_web_contents),
1691 reinterpret_cast<ui::ViewAndroid*>(view_android), 1698 reinterpret_cast<ui::ViewAndroid*>(view_android),
1692 reinterpret_cast<ui::WindowAndroid*>(window_android)); 1699 reinterpret_cast<ui::WindowAndroid*>(window_android));
1693 return reinterpret_cast<intptr_t>(view); 1700 return reinterpret_cast<intptr_t>(view);
1694 } 1701 }
1695 1702
1696 bool RegisterContentViewCore(JNIEnv* env) { 1703 bool RegisterContentViewCore(JNIEnv* env) {
1697 return RegisterNativesImpl(env); 1704 return RegisterNativesImpl(env);
1698 } 1705 }
1699 1706
1700 } // namespace content 1707 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/android/content_view_core_impl.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698