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 |