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

Unified Diff: content/browser/web_contents/web_contents_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: Restructured WillHandleDeferAfterResponseStarted and DidDeferAfterResponseStarted APIs. 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/web_contents/web_contents_impl.cc
diff --git a/content/browser/web_contents/web_contents_impl.cc b/content/browser/web_contents/web_contents_impl.cc
index 9c40100612d6022542c28706a618ade5f8abd5e0..9a7bf5a39500eb4ffeb255b6d1a8e23cf8c914d2 100644
--- a/content/browser/web_contents/web_contents_impl.cc
+++ b/content/browser/web_contents/web_contents_impl.cc
@@ -3626,15 +3626,25 @@ void WebContentsImpl::DidDeferAfterResponseStarted(
const scoped_refptr<net::HttpResponseHeaders>& headers,
const GURL& url) {
#if defined(OS_ANDROID)
- ContentViewCoreImpl::FromWebContents(this)->DidDeferAfterResponseStarted(
- headers, url);
+ WebContentsAndroid* web_contents_android =
+ static_cast<WebContentsAndroid*>(GetUserData(kWebContentsAndroidKey));
+ if (!web_contents_android) {
+ web_contents_android = new WebContentsAndroid(this);
+ SetUserData(kWebContentsAndroidKey, web_contents_android);
+ }
+ web_contents_android->DidDeferAfterResponseStarted(headers, url);;
#endif
}
bool WebContentsImpl::WillHandleDeferAfterResponseStarted() {
#if defined(OS_ANDROID)
- return ContentViewCoreImpl::FromWebContents(this)->
- WillHandleDeferAfterResponseStarted();
+ WebContentsAndroid* web_contents_android =
+ static_cast<WebContentsAndroid*>(GetUserData(kWebContentsAndroidKey));
+ if (!web_contents_android) {
AKVT 2014/08/05 13:58:43 This part please correct if I added extra code.
+ web_contents_android = new WebContentsAndroid(this);
+ SetUserData(kWebContentsAndroidKey, web_contents_android);
+ }
+ return web_contents_android->WillHandleDeferAfterResponseStarted();
#else
return false;
#endif

Powered by Google App Engine
This is Rietveld 408576698