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 "android_webview/browser/aw_javascript_dialog_manager.h" | 7 #include "android_webview/browser/aw_javascript_dialog_manager.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_contents_io_thread_client_impl.h" | 10 #include "android_webview/native/aw_contents_io_thread_client_impl.h" |
11 #include "android_webview/native/permission/media_access_permission_request.h" | 11 #include "android_webview/native/permission/media_access_permission_request.h" |
12 #include "android_webview/native/permission/permission_request_handler.h" | 12 #include "android_webview/native/permission/permission_request_handler.h" |
13 #include "base/android/jni_array.h" | 13 #include "base/android/jni_array.h" |
14 #include "base/android/jni_string.h" | 14 #include "base/android/jni_string.h" |
15 #include "base/android/scoped_java_ref.h" | 15 #include "base/android/scoped_java_ref.h" |
16 #include "base/lazy_instance.h" | 16 #include "base/lazy_instance.h" |
| 17 #include "base/location.h" |
17 #include "base/memory/ptr_util.h" | 18 #include "base/memory/ptr_util.h" |
18 #include "base/message_loop/message_loop.h" | 19 #include "base/single_thread_task_runner.h" |
19 #include "base/strings/string_util.h" | 20 #include "base/strings/string_util.h" |
20 #include "base/strings/utf_string_conversions.h" | 21 #include "base/strings/utf_string_conversions.h" |
| 22 #include "base/threading/thread_task_runner_handle.h" |
21 #include "content/public/browser/render_process_host.h" | 23 #include "content/public/browser/render_process_host.h" |
22 #include "content/public/browser/render_view_host.h" | 24 #include "content/public/browser/render_view_host.h" |
23 #include "content/public/browser/render_widget_host.h" | 25 #include "content/public/browser/render_widget_host.h" |
24 #include "content/public/browser/web_contents.h" | 26 #include "content/public/browser/web_contents.h" |
25 #include "content/public/common/file_chooser_file_info.h" | 27 #include "content/public/common/file_chooser_file_info.h" |
26 #include "content/public/common/file_chooser_params.h" | 28 #include "content/public/common/file_chooser_params.h" |
27 #include "content/public/common/media_stream_request.h" | 29 #include "content/public/common/media_stream_request.h" |
28 #include "jni/AwWebContentsDelegate_jni.h" | 30 #include "jni/AwWebContentsDelegate_jni.h" |
29 #include "net/base/escape.h" | 31 #include "net/base/escape.h" |
30 | 32 |
(...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
151 AwContents::FromWebContents(source)->SetPendingWebContentsForPopup( | 153 AwContents::FromWebContents(source)->SetPendingWebContentsForPopup( |
152 base::WrapUnique(new_contents)); | 154 base::WrapUnique(new_contents)); |
153 // Hide the WebContents for the pop up now, we will show it again | 155 // Hide the WebContents for the pop up now, we will show it again |
154 // when the user calls us back with an AwContents to use to show it. | 156 // when the user calls us back with an AwContents to use to show it. |
155 new_contents->WasHidden(); | 157 new_contents->WasHidden(); |
156 } else { | 158 } else { |
157 // The embedder has forgone their chance to display this popup | 159 // The embedder has forgone their chance to display this popup |
158 // window, so we're done with the WebContents now. We use | 160 // window, so we're done with the WebContents now. We use |
159 // DeleteSoon as WebContentsImpl may call methods on |new_contents| | 161 // DeleteSoon as WebContentsImpl may call methods on |new_contents| |
160 // after this method returns. | 162 // after this method returns. |
161 base::MessageLoop::current()->DeleteSoon(FROM_HERE, new_contents); | 163 base::ThreadTaskRunnerHandle::Get()->DeleteSoon(FROM_HERE, new_contents); |
162 } | 164 } |
163 | 165 |
164 if (was_blocked) { | 166 if (was_blocked) { |
165 *was_blocked = !create_popup; | 167 *was_blocked = !create_popup; |
166 } | 168 } |
167 } | 169 } |
168 | 170 |
169 void AwWebContentsDelegate::NavigationStateChanged( | 171 void AwWebContentsDelegate::NavigationStateChanged( |
170 content::WebContents* source, | 172 content::WebContents* source, |
171 content::InvalidateTypes changed_flags) { | 173 content::InvalidateTypes changed_flags) { |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
309 DVLOG(0) << "File Chooser result: mode = " << mode | 311 DVLOG(0) << "File Chooser result: mode = " << mode |
310 << ", file paths = " << base::JoinString(file_path_str, ":"); | 312 << ", file paths = " << base::JoinString(file_path_str, ":"); |
311 rvh->FilesSelectedInChooser(files, mode); | 313 rvh->FilesSelectedInChooser(files, mode); |
312 } | 314 } |
313 | 315 |
314 bool RegisterAwWebContentsDelegate(JNIEnv* env) { | 316 bool RegisterAwWebContentsDelegate(JNIEnv* env) { |
315 return RegisterNativesImpl(env); | 317 return RegisterNativesImpl(env); |
316 } | 318 } |
317 | 319 |
318 } // namespace android_webview | 320 } // namespace android_webview |
OLD | NEW |