diff options
author | asargent@chromium.org <asargent@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-20 16:18:21 +0000 |
---|---|---|
committer | asargent@chromium.org <asargent@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-08-20 16:18:21 +0000 |
commit | dbb92e0d55eede17bf2ada8370650d39834e6060 (patch) | |
tree | 941532e52eceab1115b60556960abde35f786368 /chrome/utility | |
parent | e667f718463a78b7d1de5a51e71982211f00f875 (diff) | |
download | chromium_src-dbb92e0d55eede17bf2ada8370650d39834e6060.zip chromium_src-dbb92e0d55eede17bf2ada8370650d39834e6060.tar.gz chromium_src-dbb92e0d55eede17bf2ada8370650d39834e6060.tar.bz2 |
Do extensions update manifest XML parsing in a sandboxed process.
This involves moving the xml parsing code from static functions in
extension_updater.cc to a UpdateManifest class, and switching from
logging any errors directly to collecting them up and passing them
across the IPC channel.
BUG=http://crbug.com/12677
TEST=extensions auto-update should still work correctly
Review URL: http://codereview.chromium.org/164541
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@23822 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/utility')
-rw-r--r-- | chrome/utility/utility_thread.cc | 13 | ||||
-rw-r--r-- | chrome/utility/utility_thread.h | 3 |
2 files changed, 15 insertions, 1 deletions
diff --git a/chrome/utility/utility_thread.cc b/chrome/utility/utility_thread.cc index dc9f965..9c6912c 100644 --- a/chrome/utility/utility_thread.cc +++ b/chrome/utility/utility_thread.cc @@ -6,10 +6,11 @@ #include "base/file_util.h" #include "base/values.h" -#include "chrome/common/web_resource/web_resource_unpacker.h" #include "chrome/common/child_process.h" #include "chrome/common/extensions/extension_unpacker.h" +#include "chrome/common/extensions/update_manifest.h" #include "chrome/common/render_messages.h" +#include "chrome/common/web_resource/web_resource_unpacker.h" UtilityThread::UtilityThread() { ChildProcess::current()->AddRefProcess(); @@ -22,6 +23,7 @@ void UtilityThread::OnControlMessageReceived(const IPC::Message& msg) { IPC_BEGIN_MESSAGE_MAP(UtilityThread, msg) IPC_MESSAGE_HANDLER(UtilityMsg_UnpackExtension, OnUnpackExtension) IPC_MESSAGE_HANDLER(UtilityMsg_UnpackWebResource, OnUnpackWebResource) + IPC_MESSAGE_HANDLER(UtilityMsg_ParseUpdateManifest, OnParseUpdateManifest) IPC_END_MESSAGE_MAP() } @@ -53,3 +55,12 @@ void UtilityThread::OnUnpackWebResource(const std::string& resource_data) { ChildProcess::current()->ReleaseProcess(); } +void UtilityThread::OnParseUpdateManifest(const std::string& xml) { + UpdateManifest manifest; + if (!manifest.Parse(xml)) { + Send(new UtilityHostMsg_ParseUpdateManifest_Failed(manifest.errors())); + } else { + Send(new UtilityHostMsg_ParseUpdateManifest_Succeeded(manifest.results())); + } + ChildProcess::current()->ReleaseProcess(); +} diff --git a/chrome/utility/utility_thread.h b/chrome/utility/utility_thread.h index 4fad53e..b5e2ae2 100644 --- a/chrome/utility/utility_thread.h +++ b/chrome/utility/utility_thread.h @@ -30,6 +30,9 @@ class UtilityThread : public ChildThread { // IPC messages for web resource service. void OnUnpackWebResource(const std::string& resource_data); + // IPC for parsing an extensions auto-update manifest xml file. + void OnParseUpdateManifest(const std::string& xml); + DISALLOW_COPY_AND_ASSIGN(UtilityThread); }; |