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 1831 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1842 env, obj.obj(), jresult.obj()); | 1842 env, obj.obj(), jresult.obj()); |
1843 } | 1843 } |
1844 | 1844 |
1845 void ContentViewCoreImpl::WebContentsDestroyed(WebContents* web_contents) { | 1845 void ContentViewCoreImpl::WebContentsDestroyed(WebContents* web_contents) { |
1846 WebContentsViewAndroid* wcva = | 1846 WebContentsViewAndroid* wcva = |
1847 static_cast<WebContentsViewAndroid*>(web_contents->GetView()); | 1847 static_cast<WebContentsViewAndroid*>(web_contents->GetView()); |
1848 DCHECK(wcva); | 1848 DCHECK(wcva); |
1849 wcva->SetContentViewCore(NULL); | 1849 wcva->SetContentViewCore(NULL); |
1850 } | 1850 } |
1851 | 1851 |
| 1852 |
| 1853 jboolean ContentViewCoreImpl::CanLockContent(JNIEnv* env, jobject obj) { |
| 1854 RenderWidgetHostViewAndroid* rwhva = GetRenderWidgetHostViewAndroid(); |
| 1855 if (!rwhva || !rwhva->IsSurfaceAvailableForCopy() || !rwhva->IsShowing()) |
| 1856 return false; |
| 1857 return true; |
| 1858 } |
| 1859 |
| 1860 void ContentViewCoreImpl::LockContent(JNIEnv* env, jobject obj) { |
| 1861 RenderWidgetHostViewAndroid* rwhva = GetRenderWidgetHostViewAndroid(); |
| 1862 if (rwhva) |
| 1863 rwhva->LockResources(); |
| 1864 } |
| 1865 |
| 1866 void ContentViewCoreImpl::UnlockContent(JNIEnv* env, jobject obj) { |
| 1867 RenderWidgetHostViewAndroid* rwhva = GetRenderWidgetHostViewAndroid(); |
| 1868 if (rwhva) |
| 1869 rwhva->UnlockResources(); |
| 1870 } |
| 1871 |
1852 // This is called for each ContentView. | 1872 // This is called for each ContentView. |
1853 jlong Init(JNIEnv* env, | 1873 jlong Init(JNIEnv* env, |
1854 jobject obj, | 1874 jobject obj, |
1855 jlong native_web_contents, | 1875 jlong native_web_contents, |
1856 jlong view_android, | 1876 jlong view_android, |
1857 jlong window_android) { | 1877 jlong window_android) { |
1858 ContentViewCoreImpl* view = new ContentViewCoreImpl( | 1878 ContentViewCoreImpl* view = new ContentViewCoreImpl( |
1859 env, obj, | 1879 env, obj, |
1860 reinterpret_cast<WebContents*>(native_web_contents), | 1880 reinterpret_cast<WebContents*>(native_web_contents), |
1861 reinterpret_cast<ui::ViewAndroid*>(view_android), | 1881 reinterpret_cast<ui::ViewAndroid*>(view_android), |
1862 reinterpret_cast<ui::WindowAndroid*>(window_android)); | 1882 reinterpret_cast<ui::WindowAndroid*>(window_android)); |
1863 return reinterpret_cast<intptr_t>(view); | 1883 return reinterpret_cast<intptr_t>(view); |
1864 } | 1884 } |
1865 | 1885 |
1866 bool RegisterContentViewCore(JNIEnv* env) { | 1886 bool RegisterContentViewCore(JNIEnv* env) { |
1867 return RegisterNativesImpl(env); | 1887 return RegisterNativesImpl(env); |
1868 } | 1888 } |
1869 | 1889 |
1870 } // namespace content | 1890 } // namespace content |
OLD | NEW |