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 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "chrome/browser/extensions/extension_function.h" | 9 #include "chrome/browser/extensions/extension_function.h" |
10 | 10 |
11 namespace extensions { | 11 namespace extensions { |
12 | 12 |
13 class FileSystemGetDisplayPathFunction : public SyncExtensionFunction { | 13 class FileSystemGetDisplayPathFunction : public SyncExtensionFunction { |
14 public: | 14 public: |
15 DECLARE_EXTENSION_FUNCTION_NAME("fileSystem.getDisplayPath"); | 15 DECLARE_EXTENSION_FUNCTION_NAME("fileSystem.getDisplayPath"); |
16 | 16 |
17 protected: | 17 protected: |
18 virtual ~FileSystemGetDisplayPathFunction() {} | 18 virtual ~FileSystemGetDisplayPathFunction() {} |
19 virtual bool RunImpl() OVERRIDE; | 19 virtual bool RunImpl() OVERRIDE; |
20 }; | 20 }; |
21 | 21 |
22 class FileSystemPickerFunction : public AsyncExtensionFunction { | 22 class FileSystemPickerFunction : public AsyncExtensionFunction { |
| 23 public: |
| 24 // Allow picker UI to be skipped in testing. |
| 25 static void SkipPickerAndAlwaysSelectPathForTest(FilePath* path); |
| 26 static void SkipPickerAndAlwaysCancelForTest(); |
| 27 static void StopSkippingPickerForTest(); |
| 28 |
23 protected: | 29 protected: |
24 class FilePicker; | 30 class FilePicker; |
25 | 31 |
26 virtual ~FileSystemPickerFunction() {} | 32 virtual ~FileSystemPickerFunction() {} |
27 bool ShowPicker(const FilePath& suggested_path, bool for_save); | 33 bool ShowPicker(const FilePath& suggested_path, bool for_save); |
28 | 34 |
29 private: | 35 private: |
30 // FileSelected and FileSelectionCanceled are called by the file picker. | 36 // FileSelected and FileSelectionCanceled are called by the file picker. |
31 void FileSelected(const FilePath& path, bool for_save); | 37 void FileSelected(const FilePath& path, bool for_save); |
32 void FileSelectionCanceled(); | 38 void FileSelectionCanceled(); |
(...skipping 26 matching lines...) Expand all Loading... |
59 DECLARE_EXTENSION_FUNCTION_NAME("fileSystem.chooseFile"); | 65 DECLARE_EXTENSION_FUNCTION_NAME("fileSystem.chooseFile"); |
60 | 66 |
61 protected: | 67 protected: |
62 virtual ~FileSystemChooseFileFunction() {} | 68 virtual ~FileSystemChooseFileFunction() {} |
63 virtual bool RunImpl() OVERRIDE; | 69 virtual bool RunImpl() OVERRIDE; |
64 }; | 70 }; |
65 | 71 |
66 } // namespace extensions | 72 } // namespace extensions |
67 | 73 |
68 #endif // CHROME_BROWSER_EXTENSIONS_API_FILE_SYSTEM_FILE_SYSTEM_API_H_ | 74 #endif // CHROME_BROWSER_EXTENSIONS_API_FILE_SYSTEM_FILE_SYSTEM_API_H_ |
OLD | NEW |