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_FILE_SELECT_HELPER_H_ | 5 #ifndef CHROME_BROWSER_FILE_SELECT_HELPER_H_ |
6 #define CHROME_BROWSER_FILE_SELECT_HELPER_H_ | 6 #define CHROME_BROWSER_FILE_SELECT_HELPER_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
12 #include "base/gtest_prod_util.h" | 12 #include "base/gtest_prod_util.h" |
13 #include "content/public/browser/notification_observer.h" | 13 #include "content/public/browser/notification_observer.h" |
14 #include "content/public/browser/notification_registrar.h" | 14 #include "content/public/browser/notification_registrar.h" |
15 #include "content/public/common/file_chooser_params.h" | 15 #include "content/public/common/file_chooser_params.h" |
16 #include "net/base/directory_lister.h" | 16 #include "net/base/directory_lister.h" |
17 #include "ui/shell_dialogs/select_file_dialog.h" | 17 #include "ui/shell_dialogs/select_file_dialog.h" |
18 | 18 |
19 class Profile; | 19 class Profile; |
20 | 20 |
21 namespace content { | 21 namespace content { |
| 22 struct FileChooserFileInfo; |
22 class RenderViewHost; | 23 class RenderViewHost; |
23 class WebContents; | 24 class WebContents; |
24 } | 25 } |
25 | 26 |
26 namespace ui { | 27 namespace ui { |
27 struct SelectedFileInfo; | 28 struct SelectedFileInfo; |
28 } | 29 } |
29 | 30 |
30 // This class handles file-selection requests coming from WebUI elements | 31 // This class handles file-selection requests coming from WebUI elements |
31 // (via the extensions::ExtensionHost class). It implements both the | 32 // (via the extensions::ExtensionHost class). It implements both the |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
137 // Zips the package at |path| into a temporary destination. Returns the | 138 // Zips the package at |path| into a temporary destination. Returns the |
138 // temporary destination, if the zip was successful. Otherwise returns an | 139 // temporary destination, if the zip was successful. Otherwise returns an |
139 // empty path. | 140 // empty path. |
140 static base::FilePath ZipPackage(const base::FilePath& path); | 141 static base::FilePath ZipPackage(const base::FilePath& path); |
141 #endif // defined(OS_MACOSX) && !defined(OS_IOS) | 142 #endif // defined(OS_MACOSX) && !defined(OS_IOS) |
142 | 143 |
143 // Utility method that passes |files| to the render view host, and ends the | 144 // Utility method that passes |files| to the render view host, and ends the |
144 // file chooser. | 145 // file chooser. |
145 void NotifyRenderViewHostAndEnd( | 146 void NotifyRenderViewHostAndEnd( |
146 const std::vector<ui::SelectedFileInfo>& files); | 147 const std::vector<ui::SelectedFileInfo>& files); |
| 148 #if defined(OS_CHROMEOS) |
| 149 // Sends the result to the render process, and call |RunFileChooserEnd|. |
| 150 void ProcessSelectedFilesChromeOSAfterConversion( |
| 151 scoped_ptr<std::vector<content::FileChooserFileInfo>> list); |
| 152 #endif // defined(OS_CHROMEOS) |
147 | 153 |
148 // Schedules the deletion of the files in |temporary_files_| and clears the | 154 // Schedules the deletion of the files in |temporary_files_| and clears the |
149 // vector. | 155 // vector. |
150 void DeleteTemporaryFiles(); | 156 void DeleteTemporaryFiles(); |
151 | 157 |
152 // Helper method to get allowed extensions for select file dialog from | 158 // Helper method to get allowed extensions for select file dialog from |
153 // the specified accept types as defined in the spec: | 159 // the specified accept types as defined in the spec: |
154 // http://whatwg.org/html/number-state.html#attr-input-accept | 160 // http://whatwg.org/html/number-state.html#attr-input-accept |
155 // |accept_types| contains only valid lowercased MIME types or file extensions | 161 // |accept_types| contains only valid lowercased MIME types or file extensions |
156 // beginning with a period (.). | 162 // beginning with a period (.). |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 content::NotificationRegistrar notification_registrar_; | 196 content::NotificationRegistrar notification_registrar_; |
191 | 197 |
192 // Temporary files only used on OSX. This class is responsible for deleting | 198 // Temporary files only used on OSX. This class is responsible for deleting |
193 // these files when they are no longer needed. | 199 // these files when they are no longer needed. |
194 std::vector<base::FilePath> temporary_files_; | 200 std::vector<base::FilePath> temporary_files_; |
195 | 201 |
196 DISALLOW_COPY_AND_ASSIGN(FileSelectHelper); | 202 DISALLOW_COPY_AND_ASSIGN(FileSelectHelper); |
197 }; | 203 }; |
198 | 204 |
199 #endif // CHROME_BROWSER_FILE_SELECT_HELPER_H_ | 205 #endif // CHROME_BROWSER_FILE_SELECT_HELPER_H_ |
OLD | NEW |