Make FileManagerDialog::SelectFileImpl() properly accept simple filenames as default path.

This affects Chrome OS.

1 - If the default path provided isn't managed by the external filesystem
    provider, still keep the base (i.e., file) name.
2 - Fix the JS regex so that it splits the directory/leaf names correctly when
    no path is provided.

BUG=http://code.google.com/p/chromium-os/issues/detail?id=22184
TEST=The main test is that sufficiently-recent Pepper Flash should provide
     correct (Flash) Save As functionality, including the default filename;
     e.g., http://www.everythingflex.com/flex3_fp10/savetodisk/SaveToDisk.html .
     Also, "Save As" for HTML should also provide a default filename on Linux
     chromeos=1 builds.


Review URL: http://codereview.chromium.org/8414006

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@108009 0039d316-1c4b-4281-b951-d872f2087c98
parent 328fdc0f
......@@ -1274,7 +1274,7 @@ FileManager.prototype = {
FileManager.prototype.setupPath_ = function(path) {
// Split the dirname from the basename.
var ary = path.match(/^(.*?)(?:\/([^\/]+))?$/);
var ary = path.match(/^(?:(.*)\/)?([^\/]*)$/);
if (!ary) {
console.warn('Unable to split default path: ' + path);
self.changeDirectory('/', CD_NO_HISTORY);
......
......@@ -199,7 +199,7 @@ void FileManagerDialog::SelectFileImpl(
FilePath virtual_path;
if (!FileManagerUtil::ConvertFileToRelativeFileSystemPath(
owner_browser->profile(), default_path, &virtual_path)) {
virtual_path = FilePath();
virtual_path = default_path.BaseName();
}
hasMultipleFileTypeChoices_ =
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment