In the current Android code structure, ContentViewCore is just acting as a wrapper to many WebContents functions.
In this patch we are trying to position the WebContents functionalities to web_contents_android file from
ContentViewCoreImpl to make it functionally readable. Ensuring there is a one-to-one mapping between
WebContents Java and native counterparts.
BUG=398263
Review URL: https://codereview.chromium.org/414423002
Cr-Commit-Position: refs/heads/master@{#289261}
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@289261 0039d316-1c4b-4281-b951-d872f2087c98
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc
index f644ee9..57ed3e7 100644
--- a/content/browser/web_contents/web_contents_impl.cc
+++ b/content/browser/web_contents/web_contents_impl.cc
@@ -2429,8 +2429,8 @@
RenderFrameHostImpl* render_frame_host) {
#if defined(OS_ANDROID)
int render_frame_id = render_frame_host->GetRoutingID();
- ContentViewCoreImpl::FromWebContents(this)->
- DidStartNavigationTransitionForFrame(render_frame_id);
+ GetWebContentsAndroid()->DidStartNavigationTransitionForFrame(
+ render_frame_id);
#endif
}
@@ -3604,15 +3604,13 @@
void WebContentsImpl::DidDeferAfterResponseStarted(
const TransitionLayerData& transition_data) {
#if defined(OS_ANDROID)
- ContentViewCoreImpl::FromWebContents(this)->DidDeferAfterResponseStarted(
- transition_data);
+ GetWebContentsAndroid()->DidDeferAfterResponseStarted(transition_data);
#endif
}
bool WebContentsImpl::WillHandleDeferAfterResponseStarted() {
#if defined(OS_ANDROID)
- return ContentViewCoreImpl::FromWebContents(this)->
- WillHandleDeferAfterResponseStarted();
+ return GetWebContentsAndroid()->WillHandleDeferAfterResponseStarted();
#else
return false;
#endif
@@ -4098,14 +4096,17 @@
base::android::ScopedJavaLocalRef<jobject>
WebContentsImpl::GetJavaWebContents() {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+ return GetWebContentsAndroid()->GetJavaObject();
+}
+WebContentsAndroid* WebContentsImpl::GetWebContentsAndroid() {
WebContentsAndroid* web_contents_android =
static_cast<WebContentsAndroid*>(GetUserData(kWebContentsAndroidKey));
if (!web_contents_android) {
web_contents_android = new WebContentsAndroid(this);
SetUserData(kWebContentsAndroidKey, web_contents_android);
}
- return web_contents_android->GetJavaObject();
+ return web_contents_android;
}
bool WebContentsImpl::CreateRenderViewForInitialEmptyDocument() {