Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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::OnDetachedFromWebContents(WebContents* web_contents) { | |
|
Ted C
2014/01/23 01:28:42
Looking more at this, why don't you do this in Con
powei
2014/01/23 01:38:02
My first instinct was to put it in the destructor
Ted C
2014/01/23 02:00:15
Hmm...that is unfortunate. If that is the case, I
powei
2014/01/23 02:38:40
Done. Turns out ContentViewCoreImpl is already a
| |
| 1683 DCHECK_EQ(GetWebContents(), web_contents); | |
| 1684 | |
| 1685 WebContentsViewAndroid* wcva = | |
| 1686 static_cast<WebContentsViewAndroid*>(GetWebContents()->GetView()); | |
|
Ted C
2014/01/23 01:28:42
+2
powei
2014/01/23 01:38:02
Done.
| |
| 1687 DCHECK(wcva); | |
| 1688 wcva->SetContentViewCore(NULL); | |
| 1689 } | |
| 1690 | |
| 1682 // This is called for each ContentView. | 1691 // This is called for each ContentView. |
| 1683 jlong Init(JNIEnv* env, jobject obj, | 1692 jlong Init(JNIEnv* env, jobject obj, |
| 1684 jboolean hardware_accelerated, | 1693 jboolean hardware_accelerated, |
| 1685 jlong native_web_contents, | 1694 jlong native_web_contents, |
| 1686 jlong view_android, | 1695 jlong view_android, |
| 1687 jlong window_android) { | 1696 jlong window_android) { |
| 1688 ContentViewCoreImpl* view = new ContentViewCoreImpl( | 1697 ContentViewCoreImpl* view = new ContentViewCoreImpl( |
| 1689 env, obj, hardware_accelerated, | 1698 env, obj, hardware_accelerated, |
| 1690 reinterpret_cast<WebContents*>(native_web_contents), | 1699 reinterpret_cast<WebContents*>(native_web_contents), |
| 1691 reinterpret_cast<ui::ViewAndroid*>(view_android), | 1700 reinterpret_cast<ui::ViewAndroid*>(view_android), |
| 1692 reinterpret_cast<ui::WindowAndroid*>(window_android)); | 1701 reinterpret_cast<ui::WindowAndroid*>(window_android)); |
| 1693 return reinterpret_cast<intptr_t>(view); | 1702 return reinterpret_cast<intptr_t>(view); |
| 1694 } | 1703 } |
| 1695 | 1704 |
| 1696 bool RegisterContentViewCore(JNIEnv* env) { | 1705 bool RegisterContentViewCore(JNIEnv* env) { |
| 1697 return RegisterNativesImpl(env); | 1706 return RegisterNativesImpl(env); |
| 1698 } | 1707 } |
| 1699 | 1708 |
| 1700 } // namespace content | 1709 } // namespace content |
| OLD | NEW |