summaryrefslogtreecommitdiffstats
path: root/extensions/utility
diff options
context:
space:
mode:
Diffstat (limited to 'extensions/utility')
-rw-r--r--extensions/utility/utility_handler.cc38
-rw-r--r--extensions/utility/utility_handler.h5
2 files changed, 14 insertions, 29 deletions
diff --git a/extensions/utility/utility_handler.cc b/extensions/utility/utility_handler.cc
index f3c8a8c..4f4ce47 100644
--- a/extensions/utility/utility_handler.cc
+++ b/extensions/utility/utility_handler.cc
@@ -91,38 +91,22 @@ void UtilityHandler::OnUnzipToDir(const base::FilePath& zip_path,
ReleaseProcessIfNeeded();
}
-void UtilityHandler::OnUnpackExtension(
- const base::FilePath& extension_path,
- const std::string& extension_id,
- int location,
- int creation_flags) {
+void UtilityHandler::OnUnpackExtension(const base::FilePath& directory_path,
+ const std::string& extension_id,
+ int location,
+ int creation_flags) {
CHECK_GT(location, Manifest::INVALID_LOCATION);
CHECK_LT(location, Manifest::NUM_LOCATIONS);
DCHECK(ExtensionsClient::Get());
content::UtilityThread::Get()->EnsureBlinkInitialized();
- base::FilePath working_dir = extension_path.DirName();
- base::FilePath unzipped_dir = working_dir.AppendASCII(kTempExtensionName);
- base::string16 error;
- if (!base::CreateDirectory(unzipped_dir)) {
- Send(new ExtensionUtilityHostMsg_UnpackExtension_Failed(
- l10n_util::GetStringFUTF16(
- IDS_EXTENSION_PACKAGE_DIRECTORY_ERROR,
- base::i18n::GetDisplayStringInLTRDirectionality(
- unzipped_dir.LossyDisplayName()))));
- } else if (!zip::Unzip(extension_path, unzipped_dir)) {
- Send(new ExtensionUtilityHostMsg_UnpackExtension_Failed(
- l10n_util::GetStringUTF16(IDS_EXTENSION_PACKAGE_UNZIP_ERROR)));
+ Unpacker unpacker(directory_path.DirName(), directory_path, extension_id,
+ static_cast<Manifest::Location>(location), creation_flags);
+ if (unpacker.Run()) {
+ Send(new ExtensionUtilityHostMsg_UnpackExtension_Succeeded(
+ *unpacker.parsed_manifest()));
} else {
- Unpacker unpacker(working_dir, unzipped_dir, extension_id,
- static_cast<Manifest::Location>(location),
- creation_flags);
- if (unpacker.Run()) {
- Send(new ExtensionUtilityHostMsg_UnpackExtension_Succeeded(
- *unpacker.parsed_manifest()));
- } else {
- Send(new ExtensionUtilityHostMsg_UnpackExtension_Failed(
- unpacker.error_message()));
- }
+ Send(new ExtensionUtilityHostMsg_UnpackExtension_Failed(
+ unpacker.error_message()));
}
ReleaseProcessIfNeeded();
}
diff --git a/extensions/utility/utility_handler.h b/extensions/utility/utility_handler.h
index d3f0b6c..b32707f 100644
--- a/extensions/utility/utility_handler.h
+++ b/extensions/utility/utility_handler.h
@@ -34,9 +34,10 @@ class UtilityHandler {
// IPC message handlers.
void OnParseUpdateManifest(const std::string& xml);
void OnUnzipToDir(const base::FilePath& zip_path, const base::FilePath& dir);
- void OnUnpackExtension(const base::FilePath& extension_path,
+ void OnUnpackExtension(const base::FilePath& directory_path,
const std::string& extension_id,
- int location, int creation_flags);
+ int location,
+ int creation_flags);
DISALLOW_COPY_AND_ASSIGN(UtilityHandler);
};