Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(354)

Side by Side Diff: chrome/browser/extensions/api/file_system/file_system_api.h

Issue 10692105: Updates file type selector for fileSystem API (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Patch #23 broken Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | chrome/browser/extensions/api/file_system/file_system_api.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
11 namespace extensions { 12 namespace extensions {
12 13
13 class FileSystemGetDisplayPathFunction : public SyncExtensionFunction { 14 class FileSystemGetDisplayPathFunction : public SyncExtensionFunction {
14 public: 15 public:
15 DECLARE_EXTENSION_FUNCTION_NAME("fileSystem.getDisplayPath"); 16 DECLARE_EXTENSION_FUNCTION_NAME("fileSystem.getDisplayPath");
16 17
17 protected: 18 protected:
18 virtual ~FileSystemGetDisplayPathFunction() {} 19 virtual ~FileSystemGetDisplayPathFunction() {}
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 66
66 class FileSystemChooseFileFunction : public FileSystemEntryFunction { 67 class FileSystemChooseFileFunction : public FileSystemEntryFunction {
67 public: 68 public:
68 // Allow picker UI to be skipped in testing. 69 // Allow picker UI to be skipped in testing.
69 static void SkipPickerAndAlwaysSelectPathForTest(FilePath* path); 70 static void SkipPickerAndAlwaysSelectPathForTest(FilePath* path);
70 static void SkipPickerAndAlwaysCancelForTest(); 71 static void SkipPickerAndAlwaysCancelForTest();
71 static void StopSkippingPickerForTest(); 72 static void StopSkippingPickerForTest();
72 73
73 DECLARE_EXTENSION_FUNCTION_NAME("fileSystem.chooseFile"); 74 DECLARE_EXTENSION_FUNCTION_NAME("fileSystem.chooseFile");
74 75
76 typedef std::vector<linked_ptr<extensions::api::file_system::AcceptOption> >
77 AcceptOptions;
78
79 static void BuildFileTypeInfo(
80 ui::SelectFileDialog::FileTypeInfo* file_type_info,
81 const FilePath::StringType& suggested_extension,
82 const AcceptOptions* accepts,
83 const bool* acceptsAllTypes);
84 static void BuildSuggestion(const std::string* opt_name,
85 FilePath* suggested_name,
86 FilePath::StringType* suggested_extension);
87
75 protected: 88 protected:
76 class FilePicker; 89 class FilePicker;
77 90
78 virtual ~FileSystemChooseFileFunction() {} 91 virtual ~FileSystemChooseFileFunction() {}
79 virtual bool RunImpl() OVERRIDE; 92 virtual bool RunImpl() OVERRIDE;
80 bool ShowPicker(const FilePath& suggested_path, 93 bool ShowPicker(const FilePath& suggested_path,
94 const ui::SelectFileDialog::FileTypeInfo& file_type_info,
81 ui::SelectFileDialog::Type picker_type, 95 ui::SelectFileDialog::Type picker_type,
82 EntryType entry_type); 96 EntryType entry_type);
83 97
84 private: 98 private:
85 // FileSelected and FileSelectionCanceled are called by the file picker. 99 // FileSelected and FileSelectionCanceled are called by the file picker.
86 void FileSelected(const FilePath& path, EntryType entry_type); 100 void FileSelected(const FilePath& path, EntryType entry_type);
87 void FileSelectionCanceled(); 101 void FileSelectionCanceled();
88 }; 102 };
89 103
90 } // namespace extensions 104 } // namespace extensions
91 105
92 #endif // CHROME_BROWSER_EXTENSIONS_API_FILE_SYSTEM_FILE_SYSTEM_API_H_ 106 #endif // CHROME_BROWSER_EXTENSIONS_API_FILE_SYSTEM_FILE_SYSTEM_API_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/extensions/api/file_system/file_system_api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698