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/common/extensions/api/file_system.h" | |
9 #include "ui/base/dialogs/select_file_dialog.h" | 10 #include "ui/base/dialogs/select_file_dialog.h" |
10 | 11 |
12 namespace file_system = extensions::api::file_system; | |
Mihai Parparita -not on Chrome
2012/07/31 22:26:10
Namespace aliases aren't allowed in the top level
benwells
2012/07/31 23:01:19
You could also have a typedef in FileSystemChooseF
thorogood
2012/08/03 02:58:02
I've taken the typedef option inside the class def
| |
13 | |
11 namespace extensions { | 14 namespace extensions { |
12 | 15 |
13 class FileSystemGetDisplayPathFunction : public SyncExtensionFunction { | 16 class FileSystemGetDisplayPathFunction : public SyncExtensionFunction { |
14 public: | 17 public: |
15 DECLARE_EXTENSION_FUNCTION_NAME("fileSystem.getDisplayPath"); | 18 DECLARE_EXTENSION_FUNCTION_NAME("fileSystem.getDisplayPath"); |
16 | 19 |
17 protected: | 20 protected: |
18 virtual ~FileSystemGetDisplayPathFunction() {} | 21 virtual ~FileSystemGetDisplayPathFunction() {} |
19 virtual bool RunImpl() OVERRIDE; | 22 virtual bool RunImpl() OVERRIDE; |
20 }; | 23 }; |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
65 | 68 |
66 class FileSystemChooseFileFunction : public FileSystemEntryFunction { | 69 class FileSystemChooseFileFunction : public FileSystemEntryFunction { |
67 public: | 70 public: |
68 // Allow picker UI to be skipped in testing. | 71 // Allow picker UI to be skipped in testing. |
69 static void SkipPickerAndAlwaysSelectPathForTest(FilePath* path); | 72 static void SkipPickerAndAlwaysSelectPathForTest(FilePath* path); |
70 static void SkipPickerAndAlwaysCancelForTest(); | 73 static void SkipPickerAndAlwaysCancelForTest(); |
71 static void StopSkippingPickerForTest(); | 74 static void StopSkippingPickerForTest(); |
72 | 75 |
73 DECLARE_EXTENSION_FUNCTION_NAME("fileSystem.chooseFile"); | 76 DECLARE_EXTENSION_FUNCTION_NAME("fileSystem.chooseFile"); |
74 | 77 |
78 static void BuildFileTypeInfo( | |
79 ui::SelectFileDialog::FileTypeInfo* file_type_info, | |
80 const FilePath::StringType& suggested_extension, | |
81 const std::vector<linked_ptr<file_system::AcceptOption> >* accepts, | |
82 const bool* acceptsAllTypes); | |
83 static void BuildSuggestion(const std::string* opt_name, | |
84 FilePath* suggested_name, | |
85 FilePath::StringType* suggested_extension); | |
86 | |
75 protected: | 87 protected: |
76 class FilePicker; | 88 class FilePicker; |
77 | 89 |
78 virtual ~FileSystemChooseFileFunction() {} | 90 virtual ~FileSystemChooseFileFunction() {} |
79 virtual bool RunImpl() OVERRIDE; | 91 virtual bool RunImpl() OVERRIDE; |
80 bool ShowPicker(const FilePath& suggested_path, | 92 bool ShowPicker(const FilePath& suggested_path, |
93 const ui::SelectFileDialog::FileTypeInfo& file_type_info, | |
81 ui::SelectFileDialog::Type picker_type, | 94 ui::SelectFileDialog::Type picker_type, |
82 EntryType entry_type); | 95 EntryType entry_type); |
83 | 96 |
84 private: | 97 private: |
85 // FileSelected and FileSelectionCanceled are called by the file picker. | 98 // FileSelected and FileSelectionCanceled are called by the file picker. |
86 void FileSelected(const FilePath& path, EntryType entry_type); | 99 void FileSelected(const FilePath& path, EntryType entry_type); |
87 void FileSelectionCanceled(); | 100 void FileSelectionCanceled(); |
88 }; | 101 }; |
89 | 102 |
90 } // namespace extensions | 103 } // namespace extensions |
91 | 104 |
92 #endif // CHROME_BROWSER_EXTENSIONS_API_FILE_SYSTEM_FILE_SYSTEM_API_H_ | 105 #endif // CHROME_BROWSER_EXTENSIONS_API_FILE_SYSTEM_FILE_SYSTEM_API_H_ |
OLD | NEW |