Skip to content

Commit

Permalink
gtk: Make directory selection work with upload type
Browse files Browse the repository at this point in the history
(<input webkitdirectory>).

Right now it hits NOTREACHED().
uploads have type = SELECT_UPLOAD_FOLDER.
They should be treated same as SELECT_OPEN_FILE and SELECT_FOLDER to
save the last opened directory path.

BUG=None
Test=Manually with a packaged app that has input element:
<input type="file" webkitdirectory id="directory"/>

Review URL: https://codereview.chromium.org/111843004

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@240564 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
lazyboy@chromium.org committed Dec 13, 2013
1 parent 52c1495 commit 8cddbd8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
8 changes: 5 additions & 3 deletions chrome/browser/ui/libgtk2ui/select_file_dialog_impl_gtk2.cc
Original file line number Diff line number Diff line change
Expand Up @@ -335,12 +335,14 @@ void SelectFileDialogImplGTK::AddFilters(GtkFileChooser* chooser) {

void SelectFileDialogImplGTK::FileSelected(GtkWidget* dialog,
const base::FilePath& path) {
if (type_ == SELECT_SAVEAS_FILE)
if (type_ == SELECT_SAVEAS_FILE) {
*last_saved_path_ = path.DirName();
else if (type_ == SELECT_OPEN_FILE || type_ == SELECT_FOLDER)
} else if (type_ == SELECT_OPEN_FILE || type_ == SELECT_FOLDER ||
type_ == SELECT_UPLOAD_FOLDER) {
*last_opened_path_ = path.DirName();
else
} else {
NOTREACHED();
}

if (listener_) {
GtkFileFilter* selected_filter =
Expand Down
8 changes: 5 additions & 3 deletions ui/shell_dialogs/gtk/select_file_dialog_impl_gtk.cc
Original file line number Diff line number Diff line change
Expand Up @@ -291,12 +291,14 @@ void SelectFileDialogImplGTK::AddFilters(GtkFileChooser* chooser) {

void SelectFileDialogImplGTK::FileSelected(GtkWidget* dialog,
const base::FilePath& path) {
if (type_ == SELECT_SAVEAS_FILE)
if (type_ == SELECT_SAVEAS_FILE) {
*last_saved_path_ = path.DirName();
else if (type_ == SELECT_OPEN_FILE || type_ == SELECT_FOLDER)
} else if (type_ == SELECT_OPEN_FILE || type_ == SELECT_FOLDER ||
type_ == SELECT_UPLOAD_FOLDER) {
*last_opened_path_ = path.DirName();
else
} else {
NOTREACHED();
}

if (listener_) {
GtkFileFilter* selected_filter =
Expand Down

0 comments on commit 8cddbd8

Please sign in to comment.