Commit 704b7790 authored by Shakti Sahu's avatar Shakti Sahu Committed by Commit Bot

ThinWebView : Add tab helpers

Bug: 1054552
Change-Id: I7fc3d29498aec9a429e792145f865f0e6898d542
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2090606
Commit-Queue: Shakti Sahu <shaktisahu@chromium.org>
Reviewed-by: default avatarDavid Trainor <dtrainor@chromium.org>
Cr-Commit-Position: refs/heads/master@{#748541}
parent 1611a81a
......@@ -294,14 +294,6 @@ public class PageInfoController implements ModalDialogProperties.Controller,
activity, mWindowAndroid, mFullUrl, showTitle, this, mView::setPermissions);
mNativePageInfoController = PageInfoControllerJni.get().init(this, mWebContents);
// TODO(crbug.com/1053859): For non-tab related WebContents (e.g.,
// PaymentHandlerCoordinator), TabSpecificContentSettings should be initiated when the
// WebContents is created. Reasons: CookieControlsBridge assumes that the webContents
// already has TabSpecificContentSettings. It's true for tab related WebContents; but it's
// not for non-tab related WebContents, e.g., PaymentHandlerCoordinator. Before it's fixed,
// we work around it by placing CookieControlsBridge after PageInfoControllerJni because the
// jni creates TabSpecificContentSettings for webContents.
mBridge = new CookieControlsBridge(this, webContents);
CookieControlsView.CookieControlsParams cookieControlsParams =
new CookieControlsView.CookieControlsParams();
......
shaktisahu@chromium.org
dtrainor@chromium.org
shaktisahu@chromium.org
......@@ -16,6 +16,7 @@ static_library("internal") {
deps = [
":jni_headers",
"//cc",
"//chrome/browser/ui",
"//skia",
]
......
......@@ -7,6 +7,8 @@
#include "base/android/jni_android.h"
#include "cc/layers/layer.h"
#include "chrome/browser/android/thin_webview/internal/jni_headers/ThinWebViewImpl_jni.h"
#include "chrome/browser/ui/android/view_android_helper.h"
#include "chrome/browser/ui/tab_helpers.h"
#include "components/embedder_support/android/delegate/web_contents_delegate_android.h"
#include "content/public/browser/web_contents.h"
......@@ -72,6 +74,10 @@ void ThinWebView::SetWebContents(content::WebContents* web_contents,
web_contents_delegate_.reset(delegate);
if (delegate)
web_contents->SetDelegate(delegate);
TabHelpers::AttachTabHelpers(web_contents);
ViewAndroidHelper::FromWebContents(web_contents)
->SetViewAndroid(web_contents->GetNativeView());
}
void ThinWebView::SizeChanged(JNIEnv* env,
......
......@@ -21,6 +21,12 @@ namespace prerender {
class PrerenderContents;
}
namespace thin_webview {
namespace android {
class ThinWebView;
}
} // namespace thin_webview
// A "tab contents" is a WebContents that is used as a tab in a browser window
// (or the equivalent on Android). The TabHelpers class allows specific classes
// to attach the set of tab helpers that is used for tab contents.
......@@ -52,6 +58,10 @@ class TabHelpers {
// the full set of tab helpers to deal with it.
friend class prerender::PrerenderContents;
// ThinWebView is used to host WebContents on non-tab UIs in Android. Most
// clients of ThinWebView will need a major subset of the tab helpers.
friend class thin_webview::android::ThinWebView;
// FYI: Do NOT add any more friends here. The functions above are the ONLY
// ones that need to call AttachTabHelpers; if you think you do, re-read the
// design document linked above, especially the section "Reusing tab helpers".
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment