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

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

Issue 414423002: Removing ContentViewCore dependencies from few functions which acts as direct wrapper to WebContents (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed review comments and ignored RWHVA functions from this patch Created 6 years, 4 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
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 801 matching lines...) Expand 10 before | Expand all | Expand 10 after
812 } 812 }
813 813
814 scoped_refptr<cc::Layer> ContentViewCoreImpl::GetLayer() const { 814 scoped_refptr<cc::Layer> ContentViewCoreImpl::GetLayer() const {
815 return root_layer_.get(); 815 return root_layer_.get();
816 } 816 }
817 817
818 // ---------------------------------------------------------------------------- 818 // ----------------------------------------------------------------------------
819 // Methods called from Java via JNI 819 // Methods called from Java via JNI
820 // ---------------------------------------------------------------------------- 820 // ----------------------------------------------------------------------------
821 821
822 void ContentViewCoreImpl::SelectPopupMenuItems(JNIEnv* env, jobject obj,
Yaron 2014/08/01 16:21:12 Sorry but it's unclear why this is moving.
AKVT 2014/08/01 17:09:58 I thought to untouch only RWHVA functions. This fu
Ted C 2014/08/01 17:26:20 The goal of the java WebContents class is to act a
AKVT 2014/08/02 10:03:59 Thanks Ted. I have removed this function from the
823 jintArray indices) {
824 RenderViewHostImpl* rvhi = static_cast<RenderViewHostImpl*>(
825 web_contents_->GetRenderViewHost());
826 DCHECK(rvhi);
827 if (indices == NULL) {
828 rvhi->DidCancelPopupMenu();
829 return;
830 }
831
832 int selected_count = env->GetArrayLength(indices);
833 std::vector<int> selected_indices;
834 jint* indices_ptr = env->GetIntArrayElements(indices, NULL);
835 for (int i = 0; i < selected_count; ++i)
836 selected_indices.push_back(indices_ptr[i]);
837 env->ReleaseIntArrayElements(indices, indices_ptr, JNI_ABORT);
838 rvhi->DidSelectPopupMenuItems(selected_indices);
839 }
840
841 void ContentViewCoreImpl::LoadUrl( 822 void ContentViewCoreImpl::LoadUrl(
842 JNIEnv* env, jobject obj, 823 JNIEnv* env, jobject obj,
843 jstring url, 824 jstring url,
844 jint load_url_type, 825 jint load_url_type,
845 jint transition_type, 826 jint transition_type,
846 jstring j_referrer_url, 827 jstring j_referrer_url,
847 jint referrer_policy, 828 jint referrer_policy,
848 jint ua_override_option, 829 jint ua_override_option,
849 jstring extra_headers, 830 jstring extra_headers,
850 jbyteArray post_data, 831 jbyteArray post_data,
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
888 params.referrer = content::Referrer( 869 params.referrer = content::Referrer(
889 GURL(ConvertJavaStringToUTF8(env, j_referrer_url)), 870 GURL(ConvertJavaStringToUTF8(env, j_referrer_url)),
890 static_cast<blink::WebReferrerPolicy>(referrer_policy)); 871 static_cast<blink::WebReferrerPolicy>(referrer_policy));
891 } 872 }
892 873
893 params.is_renderer_initiated = is_renderer_initiated; 874 params.is_renderer_initiated = is_renderer_initiated;
894 875
895 LoadUrl(params); 876 LoadUrl(params);
896 } 877 }
897 878
898 ScopedJavaLocalRef<jstring> ContentViewCoreImpl::GetURL(
899 JNIEnv* env, jobject) const {
900 return ConvertUTF8ToJavaString(env, GetWebContents()->GetURL().spec());
901 }
902
903 jboolean ContentViewCoreImpl::IsIncognito(JNIEnv* env, jobject obj) {
904 return GetWebContents()->GetBrowserContext()->IsOffTheRecord();
905 }
906
907 WebContents* ContentViewCoreImpl::GetWebContents() const { 879 WebContents* ContentViewCoreImpl::GetWebContents() const {
908 return web_contents_; 880 return web_contents_;
909 } 881 }
910 882
911 void ContentViewCoreImpl::SetFocus(JNIEnv* env, jobject obj, jboolean focused) { 883 void ContentViewCoreImpl::SetFocus(JNIEnv* env, jobject obj, jboolean focused) {
912 SetFocusInternal(focused); 884 SetFocusInternal(focused);
913 } 885 }
914 886
915 void ContentViewCoreImpl::SetFocusInternal(bool focused) { 887 void ContentViewCoreImpl::SetFocusInternal(bool focused) {
916 if (!GetRenderWidgetHostViewAndroid()) 888 if (!GetRenderWidgetHostViewAndroid())
(...skipping 575 matching lines...) Expand 10 before | Expand all | Expand 10 after
1492 static_cast<int>(x / dpi_scale()), 1464 static_cast<int>(x / dpi_scale()),
1493 static_cast<int>(y / dpi_scale()), 1465 static_cast<int>(y / dpi_scale()),
1494 static_cast<int>((width > 0 && width < dpi_scale()) ? 1466 static_cast<int>((width > 0 && width < dpi_scale()) ?
1495 1 : (int)(width / dpi_scale())), 1467 1 : (int)(width / dpi_scale())),
1496 static_cast<int>((height > 0 && height < dpi_scale()) ? 1468 static_cast<int>((height > 0 && height < dpi_scale()) ?
1497 1 : (int)(height / dpi_scale()))); 1469 1 : (int)(height / dpi_scale())));
1498 GetWebContents()->Send(new ViewMsg_ExtractSmartClipData( 1470 GetWebContents()->Send(new ViewMsg_ExtractSmartClipData(
1499 GetWebContents()->GetRoutingID(), rect)); 1471 GetWebContents()->GetRoutingID(), rect));
1500 } 1472 }
1501 1473
1502 void ContentViewCoreImpl::ResumeResponseDeferredAtStart(JNIEnv* env,
1503 jobject obj) {
1504 static_cast<WebContentsImpl*>(GetWebContents())->
1505 ResumeResponseDeferredAtStart();
1506 }
1507
1508 void ContentViewCoreImpl::SetHasPendingNavigationTransitionForTesting(
1509 JNIEnv* env,
1510 jobject obj) {
1511 RenderFrameHost* frame = static_cast<WebContentsImpl*>(GetWebContents())->
1512 GetMainFrame();
1513 BrowserThread::PostTask(
1514 BrowserThread::IO,
1515 FROM_HERE,
1516 base::Bind(
1517 &TransitionRequestManager::SetHasPendingTransitionRequest,
1518 base::Unretained(TransitionRequestManager::GetInstance()),
1519 frame->GetProcess()->GetID(),
1520 frame->GetRoutingID(),
1521 true));
1522 }
1523
1524 jint ContentViewCoreImpl::GetCurrentRenderProcessId(JNIEnv* env, jobject obj) { 1474 jint ContentViewCoreImpl::GetCurrentRenderProcessId(JNIEnv* env, jobject obj) {
1525 return GetRenderProcessIdFromRenderViewHost( 1475 return GetRenderProcessIdFromRenderViewHost(
1526 web_contents_->GetRenderViewHost()); 1476 web_contents_->GetRenderViewHost());
1527 } 1477 }
1528 1478
1529 void ContentViewCoreImpl::SetBackgroundOpaque(JNIEnv* env, jobject jobj, 1479 void ContentViewCoreImpl::SetBackgroundOpaque(JNIEnv* env, jobject jobj,
1530 jboolean opaque) { 1480 jboolean opaque) {
1531 if (GetRenderWidgetHostViewAndroid()) 1481 if (GetRenderWidgetHostViewAndroid())
1532 GetRenderWidgetHostViewAndroid()->SetBackgroundOpaque(opaque); 1482 GetRenderWidgetHostViewAndroid()->SetBackgroundOpaque(opaque);
1533 } 1483 }
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
1637 reinterpret_cast<ui::WindowAndroid*>(window_android), 1587 reinterpret_cast<ui::WindowAndroid*>(window_android),
1638 retained_objects_set); 1588 retained_objects_set);
1639 return reinterpret_cast<intptr_t>(view); 1589 return reinterpret_cast<intptr_t>(view);
1640 } 1590 }
1641 1591
1642 bool RegisterContentViewCore(JNIEnv* env) { 1592 bool RegisterContentViewCore(JNIEnv* env) {
1643 return RegisterNativesImpl(env); 1593 return RegisterNativesImpl(env);
1644 } 1594 }
1645 1595
1646 } // namespace content 1596 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/android/content_view_core_impl.h ('k') | content/browser/web_contents/web_contents_android.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698