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

Unified Diff: extensions/utility/utility_handler.cc

Issue 864093002: Move sandboxed_unpacker.{h,cc} from chrome/ to extensions/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix compile errors Created 5 years, 11 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 | « extensions/utility/utility_handler.h ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
« no previous file with comments | « extensions/utility/utility_handler.h ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698