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 "chrome/common/extensions/api/file_system.h" |
10 #include "ui/shell_dialogs/select_file_dialog.h" | 10 #include "ui/shell_dialogs/select_file_dialog.h" |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 virtual ~FileSystemIsWritableEntryFunction() {} | 66 virtual ~FileSystemIsWritableEntryFunction() {} |
67 virtual bool RunImpl() OVERRIDE; | 67 virtual bool RunImpl() OVERRIDE; |
68 }; | 68 }; |
69 | 69 |
70 class FileSystemChooseEntryFunction : public FileSystemEntryFunction { | 70 class FileSystemChooseEntryFunction : public FileSystemEntryFunction { |
71 public: | 71 public: |
72 // Allow picker UI to be skipped in testing. | 72 // Allow picker UI to be skipped in testing. |
73 static void SkipPickerAndAlwaysSelectPathForTest(base::FilePath* path); | 73 static void SkipPickerAndAlwaysSelectPathForTest(base::FilePath* path); |
74 static void SkipPickerAndAlwaysCancelForTest(); | 74 static void SkipPickerAndAlwaysCancelForTest(); |
75 static void StopSkippingPickerForTest(); | 75 static void StopSkippingPickerForTest(); |
| 76 // Call this with the directory for test file paths. On Chrome OS, accessed |
| 77 // path needs to be explicitly registered for smooth integration with Google |
| 78 // Drive support. |
| 79 static void RegisterTempExternalFileSystemForTest(const std::string& name, |
| 80 const base::FilePath& path); |
76 | 81 |
77 DECLARE_EXTENSION_FUNCTION("fileSystem.chooseEntry", FILESYSTEM_CHOOSEENTRY) | 82 DECLARE_EXTENSION_FUNCTION("fileSystem.chooseEntry", FILESYSTEM_CHOOSEENTRY) |
78 | 83 |
79 typedef std::vector<linked_ptr<extensions::api::file_system::AcceptOption> > | 84 typedef std::vector<linked_ptr<extensions::api::file_system::AcceptOption> > |
80 AcceptOptions; | 85 AcceptOptions; |
81 | 86 |
82 static void BuildFileTypeInfo( | 87 static void BuildFileTypeInfo( |
83 ui::SelectFileDialog::FileTypeInfo* file_type_info, | 88 ui::SelectFileDialog::FileTypeInfo* file_type_info, |
84 const base::FilePath::StringType& suggested_extension, | 89 const base::FilePath::StringType& suggested_extension, |
85 const AcceptOptions* accepts, | 90 const AcceptOptions* accepts, |
(...skipping 14 matching lines...) Expand all Loading... |
100 | 105 |
101 private: | 106 private: |
102 // FileSelected and FileSelectionCanceled are called by the file picker. | 107 // FileSelected and FileSelectionCanceled are called by the file picker. |
103 void FileSelected(const base::FilePath& path, EntryType entry_type); | 108 void FileSelected(const base::FilePath& path, EntryType entry_type); |
104 void FileSelectionCanceled(); | 109 void FileSelectionCanceled(); |
105 }; | 110 }; |
106 | 111 |
107 } // namespace extensions | 112 } // namespace extensions |
108 | 113 |
109 #endif // CHROME_BROWSER_EXTENSIONS_API_FILE_SYSTEM_FILE_SYSTEM_API_H_ | 114 #endif // CHROME_BROWSER_EXTENSIONS_API_FILE_SYSTEM_FILE_SYSTEM_API_H_ |
OLD | NEW |