| Index: extensions/utility/utility_handler.cc
|
| diff --git a/extensions/utility/utility_handler.cc b/extensions/utility/utility_handler.cc
|
| index 1298933336cd2ca80818d6ec51a1231f1d04a5f4..3add93ed3694a5cb52a718ffe8aecb3db24e4e09 100644
|
| --- a/extensions/utility/utility_handler.cc
|
| +++ b/extensions/utility/utility_handler.cc
|
| @@ -5,11 +5,15 @@
|
| #include "extensions/utility/utility_handler.h"
|
|
|
| #include "base/command_line.h"
|
| +#include "base/files/file_path.h"
|
| #include "content/public/utility/utility_thread.h"
|
| #include "extensions/common/extension.h"
|
| #include "extensions/common/extension_l10n_util.h"
|
| #include "extensions/common/extension_utility_messages.h"
|
| +#include "extensions/common/extensions_client.h"
|
| +#include "extensions/common/manifest.h"
|
| #include "extensions/common/update_manifest.h"
|
| +#include "extensions/utility/unpacker.h"
|
| #include "ipc/ipc_message.h"
|
| #include "ipc/ipc_message_macros.h"
|
| #include "ui/base/ui_base_switches.h"
|
| @@ -45,6 +49,7 @@ void UtilityHandler::UtilityThreadStarted() {
|
| bool UtilityHandler::OnMessageReceived(const IPC::Message& message) {
|
| bool handled = true;
|
| IPC_BEGIN_MESSAGE_MAP(UtilityHandler, message)
|
| + IPC_MESSAGE_HANDLER(ChromeUtilityMsg_UnpackExtension, OnUnpackExtension)
|
| IPC_MESSAGE_HANDLER(ExtensionUtilityMsg_ParseUpdateManifest,
|
| OnParseUpdateManifest)
|
| IPC_MESSAGE_UNHANDLED(handled = false)
|
| @@ -64,4 +69,29 @@ void UtilityHandler::OnParseUpdateManifest(const std::string& xml) {
|
| ReleaseProcessIfNeeded();
|
| }
|
|
|
| +void UtilityHandler::OnUnpackExtension(
|
| + const base::FilePath& extension_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());
|
| + Unpacker unpacker(extension_path,
|
| + extension_id,
|
| + static_cast<Manifest::Location>(location),
|
| + creation_flags);
|
| + if (unpacker.Run() && unpacker.DumpImagesToFile() &&
|
| + unpacker.DumpMessageCatalogsToFile()) {
|
| + Send(new ChromeUtilityHostMsg_UnpackExtension_Succeeded(
|
| + *unpacker.parsed_manifest()));
|
| + } else {
|
| + Send(new ChromeUtilityHostMsg_UnpackExtension_Failed(
|
| + unpacker.error_message()));
|
| + }
|
| +
|
| + ReleaseProcessIfNeeded();
|
| +}
|
| +
|
| +
|
| } // namespace extensions
|
|
|