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

Unified Diff: chrome/browser/ui/views/select_file_dialog_extension.cc

Issue 13614002: Use last_selected_directory() when invalid path is passed to CrOS file picker. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 9 months 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/views/select_file_dialog_extension.cc
diff --git a/chrome/browser/ui/views/select_file_dialog_extension.cc b/chrome/browser/ui/views/select_file_dialog_extension.cc
index 0b7bb25bbf7d99878e61295816c3e367fa58af8e..0d283dc747a16c1c7c2f48a6c28c3242f2d85922 100644
--- a/chrome/browser/ui/views/select_file_dialog_extension.cc
+++ b/chrome/browser/ui/views/select_file_dialog_extension.cc
@@ -321,10 +321,20 @@ void SelectFileDialogExtension::SelectFileImpl(
}
base::FilePath virtual_path;
- if (file_manager_util::ConvertFileToRelativeFileSystemPath(
- profile_, kFileBrowserDomain, default_dialog_path, &virtual_path)) {
+ // If an absolute path is specified as the default path, convert it to the
+ // virtual path in the file browser extension. Due to the current design,
+ // an invalid temporal cache file path may passed as |default_dialog_path|
+ // (crbug.com/178013 #9-#11). In such a case, we use the last selected
+ // directory as a workaround. Real fix is tracked at crbug.com/110119.
+ if (default_dialog_path.IsAbsolute() &&
+ (file_manager_util::ConvertFileToRelativeFileSystemPath(
+ profile_, kFileBrowserDomain, default_dialog_path, &virtual_path) ||
+ file_manager_util::ConvertFileToRelativeFileSystemPath(
+ profile_, kFileBrowserDomain, profile_->last_selected_directory(),
+ &virtual_path))) {
virtual_path = base::FilePath("/").Append(virtual_path);
} else {
+ // If the path was relative, or failed to convert, just use the base name,
virtual_path = default_dialog_path.BaseName();
}
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698