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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 if (!GetFilePathOfFileEntry(filesystem_name, filesystem_path, | 97 if (!GetFilePathOfFileEntry(filesystem_name, filesystem_path, |
98 render_view_host_, &file_path, &error_)) { | 98 render_view_host_, &file_path, &error_)) { |
99 return false; | 99 return false; |
100 } | 100 } |
101 | 101 |
102 result_.reset(base::Value::CreateStringValue(file_path.value())); | 102 result_.reset(base::Value::CreateStringValue(file_path.value())); |
103 return true; | 103 return true; |
104 } | 104 } |
105 | 105 |
106 // Handles showing a dialog to the user to ask for the filename for a file to | 106 // Handles showing a dialog to the user to ask for the filename for a file to |
107 // save. | 107 // save or open. |
108 class FileSystemPickerFunction::FilePicker : public SelectFileDialog::Listener { | 108 class FileSystemPickerFunction::FilePicker : public SelectFileDialog::Listener { |
109 public: | 109 public: |
110 FilePicker(FileSystemPickerFunction* function, | 110 FilePicker(FileSystemPickerFunction* function, |
111 content::WebContents* web_contents, | 111 content::WebContents* web_contents, |
112 const FilePath& suggested_path, | 112 const FilePath& suggested_path, |
113 bool for_save) | 113 bool for_save) |
114 : suggested_path_(suggested_path), | 114 : suggested_path_(suggested_path), |
115 for_save_(for_save), | 115 for_save_(for_save), |
116 function_(function) { | 116 function_(function) { |
117 select_file_dialog_ = SelectFileDialog::Create(this); | 117 select_file_dialog_ = SelectFileDialog::Create(this); |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
275 file_system::ChooseFileOptions* options = params->options.get(); | 275 file_system::ChooseFileOptions* options = params->options.get(); |
276 if (options) { | 276 if (options) { |
277 if (options->type.get() && *options->type == kSaveFileOption) | 277 if (options->type.get() && *options->type == kSaveFileOption) |
278 for_save = true; | 278 for_save = true; |
279 } | 279 } |
280 | 280 |
281 return ShowPicker(FilePath(), for_save); | 281 return ShowPicker(FilePath(), for_save); |
282 } | 282 } |
283 | 283 |
284 } // namespace extensions | 284 } // namespace extensions |
OLD | NEW |