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

Unified Diff: android_webview/native/aw_web_contents_delegate.cc

Issue 11362183: [Android WebView] AwContentsClient.shouldCreateWindow callback part 1. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase for landing 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
« no previous file with comments | « android_webview/native/aw_web_contents_delegate.h ('k') | android_webview/native/webview_native.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: android_webview/native/aw_web_contents_delegate.cc
diff --git a/android_webview/native/aw_web_contents_delegate.cc b/android_webview/native/aw_web_contents_delegate.cc
index 33e8edd88ed36b199d6a813613b3ce14291050de..761061226aebf5018e4c487d122106b1a09add4b 100644
--- a/android_webview/native/aw_web_contents_delegate.cc
+++ b/android_webview/native/aw_web_contents_delegate.cc
@@ -10,8 +10,10 @@
#include "android_webview/native/aw_javascript_dialog_creator.h"
#include "content/public/browser/android/download_controller_android.h"
#include "content/public/browser/web_contents.h"
+#include "jni/AwWebContentsDelegate_jni.h"
#include "net/http/http_request_headers.h"
+using base::android::AttachCurrentThread;
using content::WebContents;
namespace android_webview {
@@ -64,4 +66,35 @@ void AwWebContentsDelegate::OnStartDownload(WebContents* source,
NOTREACHED(); // We always return false in CanDownload.
}
+void AwWebContentsDelegate::AddNewContents(content::WebContents* source,
+ content::WebContents* new_contents,
+ WindowOpenDisposition disposition,
+ const gfx::Rect& initial_pos,
+ bool user_gesture,
+ bool* was_blocked) {
+ JNIEnv* env = AttachCurrentThread();
+
+ bool is_dialog = disposition == NEW_POPUP;
+ bool create_popup = Java_AwWebContentsDelegate_addNewContents(env,
+ GetJavaDelegate(env).obj(), is_dialog, user_gesture);
+
+ if (create_popup) {
+ // TODO(benm): Implement, taking ownership of new_contents.
+ NOTIMPLEMENTED() << "Popup windows are currently not supported for "
+ << "the chromium powered Android WebView.";
+ } else {
+ // The embedder has forgone their chance to display this popup
+ // window, so we're done with the WebContents now.
+ delete new_contents;
+ }
+
+ if (was_blocked) {
+ *was_blocked = !create_popup;
+ }
+}
+
+bool RegisterAwWebContentsDelegate(JNIEnv* env) {
+ return RegisterNativesImpl(env);
+}
+
} // namespace android_webview
« no previous file with comments | « android_webview/native/aw_web_contents_delegate.h ('k') | android_webview/native/webview_native.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698