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

Unified Diff: chrome/browser/file_select_helper.h

Issue 634833003: mac: Zip packages when they are selected by the file opener. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use AppendRelativePath(). Created 6 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/file_select_helper.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
};
« no previous file with comments | « no previous file | chrome/browser/file_select_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698