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" |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 mode_flags |= kFileChooserModeOpenMultiple | kFileChooserModeOpenFolder; | 109 mode_flags |= kFileChooserModeOpenMultiple | kFileChooserModeOpenFolder; |
110 } else if (params.mode == FileChooserParams::Save) { | 110 } else if (params.mode == FileChooserParams::Save) { |
111 // Save not supported, so cancel it. | 111 // Save not supported, so cancel it. |
112 render_frame_host->FilesSelectedInChooser( | 112 render_frame_host->FilesSelectedInChooser( |
113 std::vector<content::FileChooserFileInfo>(), params.mode); | 113 std::vector<content::FileChooserFileInfo>(), params.mode); |
114 return; | 114 return; |
115 } else { | 115 } else { |
116 DCHECK_EQ(FileChooserParams::Open, params.mode); | 116 DCHECK_EQ(FileChooserParams::Open, params.mode); |
117 } | 117 } |
118 Java_AwWebContentsDelegate_runFileChooser( | 118 Java_AwWebContentsDelegate_runFileChooser( |
119 env, java_delegate.obj(), render_frame_host->GetProcess()->GetID(), | 119 env, java_delegate, render_frame_host->GetProcess()->GetID(), |
120 render_frame_host->GetRoutingID(), mode_flags, | 120 render_frame_host->GetRoutingID(), mode_flags, |
121 ConvertUTF16ToJavaString( | 121 ConvertUTF16ToJavaString( |
122 env, base::JoinString(params.accept_types, base::ASCIIToUTF16(","))) | 122 env, base::JoinString(params.accept_types, base::ASCIIToUTF16(","))), |
123 .obj(), | 123 params.title.empty() ? nullptr |
124 params.title.empty() ? NULL | 124 : ConvertUTF16ToJavaString(env, params.title), |
125 : ConvertUTF16ToJavaString(env, params.title).obj(), | |
126 params.default_file_name.empty() | 125 params.default_file_name.empty() |
127 ? NULL | 126 ? nullptr |
128 : ConvertUTF8ToJavaString(env, params.default_file_name.value()) | 127 : ConvertUTF8ToJavaString(env, params.default_file_name.value()), |
129 .obj(), | |
130 params.capture); | 128 params.capture); |
131 } | 129 } |
132 | 130 |
133 void AwWebContentsDelegate::AddNewContents(WebContents* source, | 131 void AwWebContentsDelegate::AddNewContents(WebContents* source, |
134 WebContents* new_contents, | 132 WebContents* new_contents, |
135 WindowOpenDisposition disposition, | 133 WindowOpenDisposition disposition, |
136 const gfx::Rect& initial_rect, | 134 const gfx::Rect& initial_rect, |
137 bool user_gesture, | 135 bool user_gesture, |
138 bool* was_blocked) { | 136 bool* was_blocked) { |
139 JNIEnv* env = AttachCurrentThread(); | 137 JNIEnv* env = AttachCurrentThread(); |
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
314 DVLOG(0) << "File Chooser result: mode = " << mode | 312 DVLOG(0) << "File Chooser result: mode = " << mode |
315 << ", file paths = " << base::JoinString(file_path_str, ":"); | 313 << ", file paths = " << base::JoinString(file_path_str, ":"); |
316 rfh->FilesSelectedInChooser(files, mode); | 314 rfh->FilesSelectedInChooser(files, mode); |
317 } | 315 } |
318 | 316 |
319 bool RegisterAwWebContentsDelegate(JNIEnv* env) { | 317 bool RegisterAwWebContentsDelegate(JNIEnv* env) { |
320 return RegisterNativesImpl(env); | 318 return RegisterNativesImpl(env); |
321 } | 319 } |
322 | 320 |
323 } // namespace android_webview | 321 } // namespace android_webview |
OLD | NEW |