Index: android_webview/native/aw_contents.cc |
diff --git a/android_webview/native/aw_contents.cc b/android_webview/native/aw_contents.cc |
index a92c83834500d5990272e3021d898e038e076ead..7d3db9dff9567cb91eb31c90b8d3009439521e2c 100644 |
--- a/android_webview/native/aw_contents.cc |
+++ b/android_webview/native/aw_contents.cc |
@@ -7,6 +7,7 @@ |
#include "android_webview/browser/aw_browser_main_parts.h" |
#include "android_webview/browser/net_disk_cache_remover.h" |
#include "android_webview/browser/renderer_host/aw_render_view_host_ext.h" |
+#include "android_webview/browser/renderer_host/aw_resource_dispatcher_host_delegate.h" |
#include "android_webview/common/aw_hit_test_data.h" |
#include "android_webview/native/aw_browser_dependency_factory.h" |
#include "android_webview/native/aw_contents_io_thread_client_impl.h" |
@@ -24,6 +25,7 @@ |
#include "content/public/browser/browser_thread.h" |
#include "content/public/browser/cert_store.h" |
#include "content/public/browser/navigation_entry.h" |
+#include "content/public/browser/render_process_host.h" |
#include "content/public/browser/web_contents.h" |
#include "content/public/common/ssl_status.h" |
#include "jni/AwContents_jni.h" |
@@ -126,9 +128,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)); |
joth
2012/11/29 21:02:33
I think it will be clearer to move all this to jav
benm (inactive)
2012/11/30 12:54:18
Done.
|
+} |
- 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)); |
@@ -142,6 +146,10 @@ AwContents::AwContents(JNIEnv* env, |
} |
} |
+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); |
@@ -302,6 +310,9 @@ void AwContents::SetIoThreadClient(JNIEnv* env, jobject obj, jobject client) { |
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
AwContentsIoThreadClientImpl::Associate( |
web_contents_.get(), ScopedJavaLocalRef<jobject>(env, client)); |
+ int child_id = web_contents_->GetRenderProcessHost()->GetID(); |
+ int route_id = web_contents_->GetRoutingID(); |
+ AwResourceDispatcherHostDelegate::OnIoThreadClientReady(child_id, route_id); |
} |
void AwContents::SetInterceptNavigationDelegate(JNIEnv* env, |
@@ -512,4 +523,19 @@ jboolean AwContents::RestoreFromOpaqueState( |
return RestoreFromPickle(&iterator, web_contents_.get()); |
} |
+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 is still pending."; |
+ return; |
joth
2012/11/29 21:02:33
This will delete |pending|. Snag is both AwWebCont
benm (inactive)
2012/11/30 12:54:18
Good point.
|
+ } |
+ pending_contents_ = pending.Pass(); |
+} |
+ |
+jint AwContents::ReleasePopupWebContents(JNIEnv* env, jobject obj) { |
+ return reinterpret_cast<jint>(pending_contents_.release()); |
+} |
+ |
} // namespace android_webview |