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

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

Issue 2481923002: [WIP] make GURL::path() return a StringPiece (Closed)
Patch Set: thanks asan Created 4 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 unified diff | Download patch
« no previous file with comments | « no previous file | chrome/browser/browser_about_handler.cc » ('j') | 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 "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 274 matching lines...) Expand 10 before | Expand all | Expand 10 after
285 &file_path_str); 285 &file_path_str);
286 base::android::AppendJavaStringArrayToStringVector(env, display_names, 286 base::android::AppendJavaStringArrayToStringVector(env, display_names,
287 &display_name_str); 287 &display_name_str);
288 std::vector<content::FileChooserFileInfo> files; 288 std::vector<content::FileChooserFileInfo> files;
289 files.reserve(file_path_str.size()); 289 files.reserve(file_path_str.size());
290 for (size_t i = 0; i < file_path_str.size(); ++i) { 290 for (size_t i = 0; i < file_path_str.size(); ++i) {
291 GURL url(file_path_str[i]); 291 GURL url(file_path_str[i]);
292 if (!url.is_valid()) 292 if (!url.is_valid())
293 continue; 293 continue;
294 base::FilePath path(url.SchemeIsFile() ? 294 base::FilePath path(url.SchemeIsFile() ?
295 net::UnescapeURLComponent(url.path(), 295 net::UnescapeURLComponent(url.path().as_string(),
296 net::UnescapeRule::SPACES | 296 net::UnescapeRule::SPACES |
297 net::UnescapeRule::URL_SPECIAL_CHARS_EXCEPT_PATH_SEPARATORS) : 297 net::UnescapeRule::URL_SPECIAL_CHARS_EXCEPT_PATH_SEPARATORS) :
298 file_path_str[i]); 298 file_path_str[i]);
299 content::FileChooserFileInfo file_info; 299 content::FileChooserFileInfo file_info;
300 file_info.file_path = path; 300 file_info.file_path = path;
301 if (!display_name_str[i].empty()) 301 if (!display_name_str[i].empty())
302 file_info.display_name = display_name_str[i]; 302 file_info.display_name = display_name_str[i];
303 files.push_back(file_info); 303 files.push_back(file_info);
304 } 304 }
305 FileChooserParams::Mode mode; 305 FileChooserParams::Mode mode;
306 if (mode_flags & kFileChooserModeOpenFolder) { 306 if (mode_flags & kFileChooserModeOpenFolder) {
307 mode = FileChooserParams::UploadFolder; 307 mode = FileChooserParams::UploadFolder;
308 } else if (mode_flags & kFileChooserModeOpenMultiple) { 308 } else if (mode_flags & kFileChooserModeOpenMultiple) {
309 mode = FileChooserParams::OpenMultiple; 309 mode = FileChooserParams::OpenMultiple;
310 } else { 310 } else {
311 mode = FileChooserParams::Open; 311 mode = FileChooserParams::Open;
312 } 312 }
313 DVLOG(0) << "File Chooser result: mode = " << mode 313 DVLOG(0) << "File Chooser result: mode = " << mode
314 << ", file paths = " << base::JoinString(file_path_str, ":"); 314 << ", file paths = " << base::JoinString(file_path_str, ":");
315 rfh->FilesSelectedInChooser(files, mode); 315 rfh->FilesSelectedInChooser(files, mode);
316 } 316 }
317 317
318 bool RegisterAwWebContentsDelegate(JNIEnv* env) { 318 bool RegisterAwWebContentsDelegate(JNIEnv* env) {
319 return RegisterNativesImpl(env); 319 return RegisterNativesImpl(env);
320 } 320 }
321 321
322 } // namespace android_webview 322 } // namespace android_webview
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/browser_about_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698