diff options
author | asargent <asargent@chromium.org> | 2015-01-27 15:43:29 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2015-01-27 23:44:42 +0000 |
commit | 275faaaa9d7ceadaa660e113a3a799b942c1e297 (patch) | |
tree | 998a329359ae0664f0f32f5f5299c1c93ce48c92 /extensions/utility | |
parent | 151e70d6fbf2c524959bb225d86a557204571105 (diff) | |
download | chromium_src-275faaaa9d7ceadaa660e113a3a799b942c1e297.zip chromium_src-275faaaa9d7ceadaa660e113a3a799b942c1e297.tar.gz chromium_src-275faaaa9d7ceadaa660e113a3a799b942c1e297.tar.bz2 |
Move sandboxed_unpacker.{h,cc} from chrome/ to extensions/
This is a mostly mechanical change to move these files over, and
make corresponding changes to strings, build files, and include paths.
BUG=447014
Review URL: https://codereview.chromium.org/864093002
Cr-Commit-Position: refs/heads/master@{#313404}
Diffstat (limited to 'extensions/utility')
-rw-r--r-- | extensions/utility/utility_handler.cc | 30 | ||||
-rw-r--r-- | extensions/utility/utility_handler.h | 8 |
2 files changed, 38 insertions, 0 deletions
diff --git a/extensions/utility/utility_handler.cc b/extensions/utility/utility_handler.cc index 1298933..3add93e 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 diff --git a/extensions/utility/utility_handler.h b/extensions/utility/utility_handler.h index 0ae31ec..89a81d6 100644 --- a/extensions/utility/utility_handler.h +++ b/extensions/utility/utility_handler.h @@ -7,8 +7,13 @@ #include <string> +#include "base/callback.h" #include "base/macros.h" +namespace base { +class FilePath; +} + namespace IPC { class Message; } @@ -28,6 +33,9 @@ class UtilityHandler { private: // IPC message handlers. void OnParseUpdateManifest(const std::string& xml); + void OnUnpackExtension(const base::FilePath& extension_path, + const std::string& extension_id, + int location, int creation_flags); DISALLOW_COPY_AND_ASSIGN(UtilityHandler); }; |