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

Unified Diff: chrome/utility/chrome_content_utility_client.cc

Issue 11309014: File manager: support for zipping selected files. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Define zip::ZipFileList method to internalize details with handling file lists. Created 8 years, 1 month 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
Index: chrome/utility/chrome_content_utility_client.cc
diff --git a/chrome/utility/chrome_content_utility_client.cc b/chrome/utility/chrome_content_utility_client.cc
index 8e6a69ddb2146f028fcf53ba313e5d47b1397d4d..5ac464dec0515b4db4d282f1c5b9c215d9da4bac 100644
--- a/chrome/utility/chrome_content_utility_client.cc
+++ b/chrome/utility/chrome_content_utility_client.cc
@@ -21,6 +21,7 @@
#include "chrome/common/extensions/unpacker.h"
#include "chrome/common/extensions/update_manifest.h"
#include "chrome/common/web_resource/web_resource_unpacker.h"
+#include "chrome/common/zip.h"
#include "chrome/utility/profile_import_handler.h"
#include "content/public/utility/utility_thread.h"
#include "printing/backend/print_backend.h"
@@ -88,6 +89,7 @@ bool ChromeContentUtilityClient::OnMessageReceived(
IPC_MESSAGE_HANDLER(ChromeUtilityMsg_ParseJSON, OnParseJSON)
IPC_MESSAGE_HANDLER(ChromeUtilityMsg_GetPrinterCapsAndDefaults,
OnGetPrinterCapsAndDefaults)
+ IPC_MESSAGE_HANDLER(ChromeUtilityMsg_CreateZipFile, OnCreateZipFile)
IPC_MESSAGE_UNHANDLED(handled = false)
IPC_END_MESSAGE_MAP()
@@ -186,6 +188,27 @@ void ChromeContentUtilityClient::OnDecodeImageBase64(
OnDecodeImage(decoded_vector);
}
+bool ZipSelectionFilter(const std::vector<FilePath>& selection,
+ const FilePath& file_path) {
+ for (std::vector<FilePath>::const_iterator iter = selection.begin();
+ iter != selection.end(); ++iter) {
+ if (*iter == file_path || iter->IsParent(file_path))
+ return true;
+ }
+ return false;
+}
+
+void ChromeContentUtilityClient::OnCreateZipFile(
+ const FilePath& dir_path,
+ const FilePath& dest_path,
+ const std::vector<FilePath>& file_paths) {
+ if (zip::ZipFileList(dir_path, dest_path, file_paths))
+ Send(new ChromeUtilityHostMsg_CreateZipFile_Succeeded());
+ else
+ Send(new ChromeUtilityHostMsg_CreateZipFile_Failed());
+ content::UtilityThread::Get()->ReleaseProcessIfNeeded();
+}
+
void ChromeContentUtilityClient::OnRenderPDFPagesToMetafile(
base::PlatformFile pdf_file,
const FilePath& metafile_path,

Powered by Google App Engine
This is Rietveld 408576698