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 #ifndef CHROME_BROWSER_EXTENSIONS_API_FILE_SYSTEM_FILE_SYSTEM_API_H_ | 5 #ifndef CHROME_BROWSER_EXTENSIONS_API_FILE_SYSTEM_FILE_SYSTEM_API_H_ |
6 #define CHROME_BROWSER_EXTENSIONS_API_FILE_SYSTEM_FILE_SYSTEM_API_H_ | 6 #define CHROME_BROWSER_EXTENSIONS_API_FILE_SYSTEM_FILE_SYSTEM_API_H_ |
7 | 7 |
8 #include "chrome/browser/extensions/extension_function.h" | 8 #include "chrome/browser/extensions/extension_function.h" |
9 #include "chrome/browser/ui/select_file_dialog.h" | 9 #include "chrome/browser/ui/select_file_dialog.h" |
10 | 10 |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 | 65 |
66 class FileSystemChooseFileFunction : public FileSystemEntryFunction { | 66 class FileSystemChooseFileFunction : public FileSystemEntryFunction { |
67 public: | 67 public: |
68 // Allow picker UI to be skipped in testing. | 68 // Allow picker UI to be skipped in testing. |
69 static void SkipPickerAndAlwaysSelectPathForTest(FilePath* path); | 69 static void SkipPickerAndAlwaysSelectPathForTest(FilePath* path); |
70 static void SkipPickerAndAlwaysCancelForTest(); | 70 static void SkipPickerAndAlwaysCancelForTest(); |
71 static void StopSkippingPickerForTest(); | 71 static void StopSkippingPickerForTest(); |
72 | 72 |
73 DECLARE_EXTENSION_FUNCTION_NAME("fileSystem.chooseFile"); | 73 DECLARE_EXTENSION_FUNCTION_NAME("fileSystem.chooseFile"); |
74 | 74 |
| 75 static void BuildFileTypeInfo(SelectFileDialog::FileTypeInfo* file_type_info, |
| 76 const FilePath::StringType& suggested_extension, |
| 77 const std::vector<std::string>* accepts, |
| 78 const bool* acceptsAllTypes); |
| 79 static void BuildSuggestion(const std::string* opt_name, |
| 80 FilePath* suggested_name, |
| 81 FilePath::StringType* suggested_extension); |
| 82 |
75 protected: | 83 protected: |
76 class FilePicker; | 84 class FilePicker; |
77 | 85 |
78 virtual ~FileSystemChooseFileFunction() {} | 86 virtual ~FileSystemChooseFileFunction() {} |
79 virtual bool RunImpl() OVERRIDE; | 87 virtual bool RunImpl() OVERRIDE; |
80 bool ShowPicker(const FilePath& suggested_path, | 88 bool ShowPicker(const FilePath& suggested_path, |
| 89 const SelectFileDialog::FileTypeInfo& file_type_info, |
81 SelectFileDialog::Type picker_type, | 90 SelectFileDialog::Type picker_type, |
82 EntryType entry_type); | 91 EntryType entry_type); |
83 | 92 |
84 private: | 93 private: |
85 // FileSelected and FileSelectionCanceled are called by the file picker. | 94 // FileSelected and FileSelectionCanceled are called by the file picker. |
86 void FileSelected(const FilePath& path, EntryType entry_type); | 95 void FileSelected(const FilePath& path, EntryType entry_type); |
87 void FileSelectionCanceled(); | 96 void FileSelectionCanceled(); |
88 }; | 97 }; |
89 | 98 |
90 } // namespace extensions | 99 } // namespace extensions |
91 | 100 |
92 #endif // CHROME_BROWSER_EXTENSIONS_API_FILE_SYSTEM_FILE_SYSTEM_API_H_ | 101 #endif // CHROME_BROWSER_EXTENSIONS_API_FILE_SYSTEM_FILE_SYSTEM_API_H_ |
OLD | NEW |