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

Side by Side Diff: android_webview/native/aw_web_contents_delegate.cc

Issue 11348075: [Android WebView] AwContentsClient.shouldCreate window callback part 2. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix spurious includes. Created 8 years 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « android_webview/native/aw_contents.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "android_webview/native/aw_web_contents_delegate.h" 5 #include "android_webview/native/aw_web_contents_delegate.h"
6 6
7 #include "base/lazy_instance.h"
8 #include "android_webview/browser/find_helper.h" 7 #include "android_webview/browser/find_helper.h"
9 #include "android_webview/native/aw_contents.h" 8 #include "android_webview/native/aw_contents.h"
10 #include "android_webview/native/aw_javascript_dialog_creator.h" 9 #include "android_webview/native/aw_javascript_dialog_creator.h"
10 #include "base/lazy_instance.h"
11 #include "base/message_loop.h"
11 #include "content/public/browser/android/download_controller_android.h" 12 #include "content/public/browser/android/download_controller_android.h"
12 #include "content/public/browser/web_contents.h" 13 #include "content/public/browser/web_contents.h"
13 #include "jni/AwWebContentsDelegate_jni.h" 14 #include "jni/AwWebContentsDelegate_jni.h"
14 #include "net/http/http_request_headers.h" 15 #include "net/http/http_request_headers.h"
15 16
16 using base::android::AttachCurrentThread; 17 using base::android::AttachCurrentThread;
17 using content::WebContents; 18 using content::WebContents;
18 19
19 namespace android_webview { 20 namespace android_webview {
20 21
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
72 const gfx::Rect& initial_pos, 73 const gfx::Rect& initial_pos,
73 bool user_gesture, 74 bool user_gesture,
74 bool* was_blocked) { 75 bool* was_blocked) {
75 JNIEnv* env = AttachCurrentThread(); 76 JNIEnv* env = AttachCurrentThread();
76 77
77 bool is_dialog = disposition == NEW_POPUP; 78 bool is_dialog = disposition == NEW_POPUP;
78 bool create_popup = Java_AwWebContentsDelegate_addNewContents(env, 79 bool create_popup = Java_AwWebContentsDelegate_addNewContents(env,
79 GetJavaDelegate(env).obj(), is_dialog, user_gesture); 80 GetJavaDelegate(env).obj(), is_dialog, user_gesture);
80 81
81 if (create_popup) { 82 if (create_popup) {
82 // TODO(benm): Implement, taking ownership of new_contents. 83 // The embedder would like to display the popup and we will receive
83 NOTIMPLEMENTED() << "Popup windows are currently not supported for " 84 // a callback from them later with an AwContents to use to display
84 << "the chromium powered Android WebView."; 85 // it. The source AwContents takes ownership of the new WebContents
86 // until then, and when the callback is made we will swap the WebContents
87 // out into the new AwContents.
88 AwContents::FromWebContents(source)->SetPendingWebContentsForPopup(
89 make_scoped_ptr(new_contents));
90 // Hide the WebContents for the pop up now, we will show it again
91 // when the user calls us back with an AwContents to use to show it.
92 new_contents->WasHidden();
85 } else { 93 } else {
86 // The embedder has forgone their chance to display this popup 94 // The embedder has forgone their chance to display this popup
87 // window, so we're done with the WebContents now. 95 // window, so we're done with the WebContents now. We use
88 delete new_contents; 96 // DeleteSoon as WebContentsImpl may call methods on |new_contents|
97 // after this method returns.
98 MessageLoop::current()->DeleteSoon(FROM_HERE, new_contents);
89 } 99 }
90 100
91 if (was_blocked) { 101 if (was_blocked) {
92 *was_blocked = !create_popup; 102 *was_blocked = !create_popup;
93 } 103 }
94 } 104 }
95 105
96 bool RegisterAwWebContentsDelegate(JNIEnv* env) { 106 bool RegisterAwWebContentsDelegate(JNIEnv* env) {
97 return RegisterNativesImpl(env); 107 return RegisterNativesImpl(env);
98 } 108 }
99 109
100 } // namespace android_webview 110 } // namespace android_webview
OLDNEW
« no previous file with comments | « android_webview/native/aw_contents.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698