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

Unified Diff: chrome/browser/extensions/api/file_system/file_system_api.cc

Issue 10696188: Adds the optional suggestedName to the chooseFile fileSystem API call. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 5 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 | chrome/common/extensions/api/file_system.idl » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/api/file_system/file_system_api.cc
diff --git a/chrome/browser/extensions/api/file_system/file_system_api.cc b/chrome/browser/extensions/api/file_system/file_system_api.cc
index 871125e0030030d2aab9d8263ef184ef5e896dbb..5b2339741c55253f22b7d99c4dc693a1c5c650bd 100644
--- a/chrome/browser/extensions/api/file_system/file_system_api.cc
+++ b/chrome/browser/extensions/api/file_system/file_system_api.cc
@@ -372,18 +372,26 @@ bool FileSystemChooseFileFunction::RunImpl() {
scoped_ptr<ChooseFile::Params> params(ChooseFile::Params::Create(*args_));
EXTENSION_FUNCTION_VALIDATE(params.get());
+ FilePath suggested_path;
benwells 2012/07/12 08:23:33 Nit: suggested_name
thorogood 2012/07/12 08:40:20 Done.
EntryType entry_type = READ_ONLY;
SelectFileDialog::Type picker_type = SelectFileDialog::SELECT_OPEN_FILE;
+
file_system::ChooseFileOptions* options = params->options.get();
- if (options && options->type.get()) {
- if (*options->type == kOpenWritableFileOption) {
- entry_type = WRITABLE;
- } else if (*options->type == kSaveFileOption) {
- entry_type = WRITABLE;
- picker_type = SelectFileDialog::SELECT_SAVEAS_FILE;
- } else if (*options->type != kOpenFileOption) {
- error_ = kUnknownChooseFileType;
- return false;
+ if (options) {
+ if (options->type.get()) {
+ if (*options->type == kOpenWritableFileOption) {
+ entry_type = WRITABLE;
+ } else if (*options->type == kSaveFileOption) {
+ entry_type = WRITABLE;
+ picker_type = SelectFileDialog::SELECT_SAVEAS_FILE;
+ } else if (*options->type != kOpenFileOption) {
+ error_ = kUnknownChooseFileType;
+ return false;
+ }
+ }
+
+ if (options->suggested_name.get()) {
+ suggested_path = FilePath::FromUTF8Unsafe(*options->suggested_name.get())
benwells 2012/07/12 08:23:33 We should just use BaseName, so if an extension tr
thorogood 2012/07/12 08:40:20 Done. BaseName may still return an absolute path i
}
}
@@ -392,7 +400,7 @@ bool FileSystemChooseFileFunction::RunImpl() {
return false;
}
- return ShowPicker(FilePath(), picker_type, entry_type);
+ return ShowPicker(suggested_path, picker_type, entry_type);
}
} // namespace extensions
« no previous file with comments | « no previous file | chrome/common/extensions/api/file_system.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698