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

Unified Diff: chrome/browser/extensions/sandboxed_extension_unpacker.cc

Issue 6995095: Move UtilityProcessHost to content and move the message sending/dispatching to the clients. This... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 6 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
Index: chrome/browser/extensions/sandboxed_extension_unpacker.cc
===================================================================
--- chrome/browser/extensions/sandboxed_extension_unpacker.cc (revision 88480)
+++ chrome/browser/extensions/sandboxed_extension_unpacker.cc (working copy)
@@ -19,6 +19,7 @@
#include "chrome/browser/extensions/extension_service.h"
#include "chrome/common/chrome_paths.h"
#include "chrome/common/chrome_switches.h"
+#include "chrome/common/chrome_utility_messages.h"
#include "chrome/common/extensions/extension.h"
#include "chrome/common/extensions/extension_constants.h"
#include "chrome/common/extensions/extension_file_util.h"
@@ -229,10 +230,39 @@
NULL);
}
+bool SandboxedExtensionUnpacker::OnMessageReceived(
+ const IPC::Message& message) {
+ bool handled = true;
+ IPC_BEGIN_MESSAGE_MAP(SandboxedExtensionUnpacker, message)
+ IPC_MESSAGE_HANDLER(UtilityHostMsg_UnpackExtension_Succeeded,
+ OnUnpackExtensionSucceeded)
+ IPC_MESSAGE_HANDLER(UtilityHostMsg_UnpackExtension_Failed,
+ OnUnpackExtensionFailed)
+ IPC_MESSAGE_UNHANDLED(handled = false)
+ IPC_END_MESSAGE_MAP_EX()
+ return handled;
+}
+
+void SandboxedExtensionUnpacker::OnProcessCrashed(int exit_code) {
+ // Don't report crashes if they happen after we got a response.
+ if (got_response_)
+ return;
+
+ // Utility process crashed while trying to install.
+ ReportFailure(
+ UTILITY_PROCESS_CRASHED_WHILE_TRYING_TO_INSTALL,
+ l10n_util::GetStringFUTF8(
+ IDS_EXTENSION_PACKAGE_INSTALL_ERROR,
+ ASCIIToUTF16("UTILITY_PROCESS_CRASHED_WHILE_TRYING_TO_INSTALL")));
+}
+
void SandboxedExtensionUnpacker::StartProcessOnIOThread(
const FilePath& temp_crx_path) {
UtilityProcessHost* host = new UtilityProcessHost(this, thread_identifier_);
- host->StartExtensionUnpacker(temp_crx_path);
+ // Grant the subprocess access to the entire subdir the extension file is
+ // in, so that it can unpack to that dir.
+ host->set_exposed_dir(temp_crx_path.DirName());
+ host->Send(new UtilityMsg_UnpackExtension(temp_crx_path));
}
void SandboxedExtensionUnpacker::OnUnpackExtensionSucceeded(
@@ -298,19 +328,6 @@
ASCIIToUTF16(error)));
}
-void SandboxedExtensionUnpacker::OnProcessCrashed(int exit_code) {
- // Don't report crashes if they happen after we got a response.
- if (got_response_)
- return;
-
- // Utility process crashed while trying to install.
- ReportFailure(
- UTILITY_PROCESS_CRASHED_WHILE_TRYING_TO_INSTALL,
- l10n_util::GetStringFUTF8(
- IDS_EXTENSION_PACKAGE_INSTALL_ERROR,
- ASCIIToUTF16("UTILITY_PROCESS_CRASHED_WHILE_TRYING_TO_INSTALL")));
-}
-
bool SandboxedExtensionUnpacker::ValidateSignature() {
ScopedStdioHandle file(file_util::OpenFile(crx_path_, "rb"));

Powered by Google App Engine
This is Rietveld 408576698