| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/extensions/api/file_system/file_system_api.h" | 5 #include "chrome/browser/extensions/api/file_system/file_system_api.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/file_path.h" | 8 #include "base/file_path.h" |
| 9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
| 10 #include "chrome/browser/extensions/shell_window_registry.h" | 10 #include "chrome/browser/extensions/shell_window_registry.h" |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 if (!GetFilePathOfFileEntry(filesystem_name, filesystem_path, | 100 if (!GetFilePathOfFileEntry(filesystem_name, filesystem_path, |
| 101 render_view_host_, &file_path, &error_)) { | 101 render_view_host_, &file_path, &error_)) { |
| 102 return false; | 102 return false; |
| 103 } | 103 } |
| 104 | 104 |
| 105 result_.reset(base::Value::CreateStringValue(file_path.value())); | 105 result_.reset(base::Value::CreateStringValue(file_path.value())); |
| 106 return true; | 106 return true; |
| 107 } | 107 } |
| 108 | 108 |
| 109 // Handles showing a dialog to the user to ask for the filename for a file to | 109 // Handles showing a dialog to the user to ask for the filename for a file to |
| 110 // save. | 110 // save or open. |
| 111 class FileSystemPickerFunction::FilePicker : public SelectFileDialog::Listener { | 111 class FileSystemPickerFunction::FilePicker : public SelectFileDialog::Listener { |
| 112 public: | 112 public: |
| 113 FilePicker(FileSystemPickerFunction* function, | 113 FilePicker(FileSystemPickerFunction* function, |
| 114 content::WebContents* web_contents, | 114 content::WebContents* web_contents, |
| 115 const FilePath& suggested_path, | 115 const FilePath& suggested_path, |
| 116 bool for_save) | 116 bool for_save) |
| 117 : suggested_path_(suggested_path), | 117 : suggested_path_(suggested_path), |
| 118 for_save_(for_save), | 118 for_save_(for_save), |
| 119 function_(function) { | 119 function_(function) { |
| 120 select_file_dialog_ = SelectFileDialog::Create(this); | 120 select_file_dialog_ = SelectFileDialog::Create(this); |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 311 file_system::ChooseFileOptions* options = params->options.get(); | 311 file_system::ChooseFileOptions* options = params->options.get(); |
| 312 if (options) { | 312 if (options) { |
| 313 if (options->type.get() && *options->type == kSaveFileOption) | 313 if (options->type.get() && *options->type == kSaveFileOption) |
| 314 for_save = true; | 314 for_save = true; |
| 315 } | 315 } |
| 316 | 316 |
| 317 return ShowPicker(FilePath(), for_save); | 317 return ShowPicker(FilePath(), for_save); |
| 318 } | 318 } |
| 319 | 319 |
| 320 } // namespace extensions | 320 } // namespace extensions |
| OLD | NEW |