Index: chrome/browser/file_select_helper.h |
diff --git a/chrome/browser/file_select_helper.h b/chrome/browser/file_select_helper.h |
index 5568478da5ffd6ffc56d499e7f78d07234b18314..cc0db8a31ca04d8b117d303c624907b453daffa6 100644 |
--- a/chrome/browser/file_select_helper.h |
+++ b/chrome/browser/file_select_helper.h |
@@ -48,6 +48,7 @@ class FileSelectHelper |
private: |
friend class base::RefCountedThreadSafe<FileSelectHelper>; |
FRIEND_TEST_ALL_PREFIXES(FileSelectHelperTest, IsAcceptTypeValid); |
+ FRIEND_TEST_ALL_PREFIXES(FileSelectHelperTest, ZipPackage); |
explicit FileSelectHelper(Profile* profile); |
virtual ~FileSelectHelper(); |
@@ -121,6 +122,33 @@ class FileSelectHelper |
// callback is received from the enumeration code. |
void EnumerateDirectoryEnd(); |
+#if defined(OS_MACOSX) && !defined(OS_IOS) |
+ // Must be called on the FILE_USER_BLOCKING thread. Each selected file that is |
+ // a package will be zipped, and the zip will be passed to the render view |
+ // host in place of the package. |
+ void ProcessSelectedFilesMac(const std::vector<ui::SelectedFileInfo>& files); |
+ |
+ // Saves the paths of |zipped_files| for later deletion. Passes |files| to the |
+ // render view host. |
+ void ProcessSelectedFilesMacOnUIThread( |
+ const std::vector<ui::SelectedFileInfo>& files, |
+ const std::vector<base::FilePath>& zipped_files); |
+ |
+ // Zips the package at |path| into a temporary destination. Returns the |
+ // temporary destination, if the zip was successful. Otherwise returns an |
+ // empty path. |
+ static base::FilePath ZipPackage(const base::FilePath& path); |
+#endif // defined(OS_MACOSX) && !defined(OS_IOS) |
+ |
+ // Utility method that passes |files| to the render view host, and ends the |
+ // file chooser. |
+ void NotifyRenderViewHostAndEnd( |
+ const std::vector<ui::SelectedFileInfo>& files); |
+ |
+ // Schedules the deletion of the files in |temporary_files_| and clears the |
+ // vector. |
+ void DeleteTemporaryFiles(); |
+ |
// Helper method to get allowed extensions for select file dialog from |
// the specified accept types as defined in the spec: |
// http://whatwg.org/html/number-state.html#attr-input-accept |
@@ -161,6 +189,10 @@ class FileSelectHelper |
// Registrar for notifications regarding our RenderViewHost. |
content::NotificationRegistrar notification_registrar_; |
+ // Temporary files only used on OSX. This class is responsible for deleting |
+ // these files when they are no longer needed. |
+ std::vector<base::FilePath> temporary_files_; |
+ |
DISALLOW_COPY_AND_ASSIGN(FileSelectHelper); |
}; |