summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorgspencer@chromium.org <gspencer@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-07-24 22:56:24 +0000
committergspencer@chromium.org <gspencer@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-07-24 22:56:24 +0000
commit3f4a1f51cb21fc48e455586f91a6d295cd8172ef (patch)
tree0c6a68f33558f1a2381d65a1387a64f29c408d2d
parentf74990416c281fcc253b8422cd239e4cc77829f3 (diff)
downloadchromium_src-3f4a1f51cb21fc48e455586f91a6d295cd8172ef.zip
chromium_src-3f4a1f51cb21fc48e455586f91a6d295cd8172ef.tar.gz
chromium_src-3f4a1f51cb21fc48e455586f91a6d295cd8172ef.tar.bz2
Merge 146147 - Open/save dialog assumes the defaultPath parameter without '/' as a default file name.
MERGE NOTE: Had to manually merge this change due to conflicts. Passed unit and browser tests for file dialog. BUG=134578 TEST=Manual test. TBR=satorux@chromium.org Review URL: https://chromiumcodereview.appspot.com/10795099 git-svn-id: svn://svn.chromium.org/chrome/branches/1180/src@148237 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/resources/file_manager/js/file_manager.js9
-rw-r--r--chrome/browser/ui/views/select_file_dialog_extension.cc4
2 files changed, 7 insertions, 6 deletions
diff --git a/chrome/browser/resources/file_manager/js/file_manager.js b/chrome/browser/resources/file_manager/js/file_manager.js
index d20e231..4243b89 100644
--- a/chrome/browser/resources/file_manager/js/file_manager.js
+++ b/chrome/browser/resources/file_manager/js/file_manager.js
@@ -19,9 +19,6 @@ function FileManager(dialogDom) {
this.params_ = location.search ?
JSON.parse(decodeURIComponent(location.search.substr(1))) :
{};
- if (this.params_.defaultPath && this.params_.defaultPath.indexOf('/') != 0)
- this.params_.defaultPath = '/' + this.params_.defaultPath;
-
this.listType_ = null;
this.showDelayTimeout_ = null;
@@ -1483,8 +1480,10 @@ FileManager.prototype = {
return;
if (!path) {
- this.directoryModel_.setupDefaultPath();
- return;
+ path = this.directoryModel_.getDefaultDirectory();
+ } else if (path.indexOf('/') == -1) {
+ // Path is a file name.
+ path = this.directoryModel_.getDefaultDirectory() + '/' + path;
}
// In the FULL_PAGE mode if the hash path points to a file we might have
diff --git a/chrome/browser/ui/views/select_file_dialog_extension.cc b/chrome/browser/ui/views/select_file_dialog_extension.cc
index b8e3d26..2d61760 100644
--- a/chrome/browser/ui/views/select_file_dialog_extension.cc
+++ b/chrome/browser/ui/views/select_file_dialog_extension.cc
@@ -266,8 +266,10 @@ void SelectFileDialogExtension::SelectFileImpl(
}
FilePath virtual_path;
- if (!file_manager_util::ConvertFileToRelativeFileSystemPath(
+ if (file_manager_util::ConvertFileToRelativeFileSystemPath(
owner_browser_->profile(), default_path, &virtual_path)) {
+ virtual_path = FilePath("/").Append(virtual_path);
+ } else {
virtual_path = default_path.BaseName();
}