Chromium Code Reviews| OLD | NEW |
|---|---|
| 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" | 7 #include "base/lazy_instance.h" |
| 8 #include "android_webview/browser/find_helper.h" | 8 #include "android_webview/browser/find_helper.h" |
| 9 #include "android_webview/native/aw_contents.h" | 9 #include "android_webview/native/aw_contents.h" |
| 10 #include "android_webview/native/aw_javascript_dialog_creator.h" | 10 #include "android_webview/native/aw_javascript_dialog_creator.h" |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 72 const gfx::Rect& initial_pos, | 72 const gfx::Rect& initial_pos, |
| 73 bool user_gesture, | 73 bool user_gesture, |
| 74 bool* was_blocked) { | 74 bool* was_blocked) { |
| 75 JNIEnv* env = AttachCurrentThread(); | 75 JNIEnv* env = AttachCurrentThread(); |
| 76 | 76 |
| 77 bool is_dialog = disposition == NEW_POPUP; | 77 bool is_dialog = disposition == NEW_POPUP; |
| 78 bool create_popup = Java_AwWebContentsDelegate_addNewContents(env, | 78 bool create_popup = Java_AwWebContentsDelegate_addNewContents(env, |
| 79 GetJavaDelegate(env).obj(), is_dialog, user_gesture); | 79 GetJavaDelegate(env).obj(), is_dialog, user_gesture); |
| 80 | 80 |
| 81 if (create_popup) { | 81 if (create_popup) { |
| 82 // TODO(benm): Implement, taking ownership of new_contents. | 82 // The embedder would like to display the popup and we will receive |
| 83 NOTIMPLEMENTED() << "Popup windows are currently not supported for " | 83 // a callback from them later with an AwContents to use to display |
| 84 << "the chromium powered Android WebView."; | 84 // it. The source AwContents takes ownership of the new WebContents |
| 85 // until then, and when the callback is made we will swap the WebContents | |
| 86 // out into the new AwContents. | |
| 87 AwContents::FromWebContents(source)->SetPendingWebContentsForPopup( | |
| 88 make_scoped_ptr(new_contents)); | |
| 89 // Hide the WebContents for the pop up now, we will show it again | |
| 90 // when the user calls us back with an AwContents to use to show it. | |
| 91 new_contents->WasHidden(); | |
| 85 } else { | 92 } else { |
| 86 // The embedder has forgone their chance to display this popup | 93 // The embedder has forgone their chance to display this popup |
| 87 // window, so we're done with the WebContents now. | 94 // window, so we're done with the WebContents now. |
| 88 delete new_contents; | 95 delete new_contents; |
|
joth
2012/11/29 21:02:33
again, MessageLoop DeleteSoon(new_contents)
benm (inactive)
2012/11/30 12:54:18
Done.
| |
| 89 } | 96 } |
| 90 | 97 |
| 91 if (was_blocked) { | 98 if (was_blocked) { |
| 92 *was_blocked = !create_popup; | 99 *was_blocked = !create_popup; |
| 93 } | 100 } |
| 94 } | 101 } |
| 95 | 102 |
| 96 bool RegisterAwWebContentsDelegate(JNIEnv* env) { | 103 bool RegisterAwWebContentsDelegate(JNIEnv* env) { |
| 97 return RegisterNativesImpl(env); | 104 return RegisterNativesImpl(env); |
| 98 } | 105 } |
| 99 | 106 |
| 100 } // namespace android_webview | 107 } // namespace android_webview |
| OLD | NEW |