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

Unified Diff: android_webview/native/aw_contents.cc

Issue 11348075: [Android WebView] AwContentsClient.shouldCreate window callback part 2. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address Marcin's comments. Created 8 years, 1 month 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: android_webview/native/aw_contents.cc
diff --git a/android_webview/native/aw_contents.cc b/android_webview/native/aw_contents.cc
index 0c8b5bd4f03f0765fb88432887b7f2696d94afa8..6eacc6bf8281ae2765d363ad97dbe3b2b492bf8a 100644
--- a/android_webview/native/aw_contents.cc
+++ b/android_webview/native/aw_contents.cc
@@ -90,9 +90,11 @@ AwContents::AwContents(JNIEnv* env,
android_webview::AwBrowserDependencyFactory* dependency_factory =
android_webview::AwBrowserDependencyFactory::GetInstance();
- web_contents_.reset(dependency_factory->CreateWebContents(private_browsing));
+ SetWebContents(dependency_factory->CreateWebContents(private_browsing));
+}
- DCHECK(!AwContents::FromWebContents(web_contents_.get()));
+void AwContents::SetWebContents(content::WebContents* web_contents) {
+ web_contents_.reset(web_contents);
web_contents_->SetUserData(kAwContentsUserDataKey,
new AwContentsUserData(this));
@@ -100,6 +102,10 @@ AwContents::AwContents(JNIEnv* env,
render_view_host_ext_.reset(new AwRenderViewHostExt(web_contents_.get()));
}
+void AwContents::SetWebContents(JNIEnv* env, jobject obj, jint new_wc) {
+ SetWebContents(reinterpret_cast<content::WebContents*>(new_wc));
+}
+
AwContents::~AwContents() {
DCHECK(AwContents::FromWebContents(web_contents_.get()) == this);
web_contents_->RemoveUserData(kAwContentsUserDataKey);
@@ -379,4 +385,19 @@ void AwContents::SetWindowViewVisibility(JNIEnv* env, jobject obj,
// TODO(joth): Set the Compositor visibility.
}
+void AwContents::SetPendingWebContentsForPopup(
+ scoped_ptr<content::WebContents> pending) {
+ if (pending_contents_.get()) {
+ // TODO(benm): Support holding multiple pop up window requests.
+ LOG(WARNING) << "Blocking popup window creation as an outstanding "
+ << " popup window still pending.";
+ return;
+ }
+ pending_contents_ = pending.Pass();
+}
+
+jint AwContents::ReleasePopupWebContents(JNIEnv* env, jobject obj) {
+ return reinterpret_cast<jint>(pending_contents_.release());
+}
+
} // namespace android_webview

Powered by Google App Engine
This is Rietveld 408576698