diff options
author | mirandac@chromium.org <mirandac@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-06-18 23:02:54 +0000 |
---|---|---|
committer | mirandac@chromium.org <mirandac@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-06-18 23:02:54 +0000 |
commit | ea0c98cfa2849f95bf40238c9f476c9cebb22244 (patch) | |
tree | ec81fe0c664cb6c0adddbd5d392313e8fbb93ec5 /chrome/utility/utility_thread.cc | |
parent | 1f70f0ca51d1c61d3a775507b2b69dcdf60e77df (diff) | |
download | chromium_src-ea0c98cfa2849f95bf40238c9f476c9cebb22244.zip chromium_src-ea0c98cfa2849f95bf40238c9f476c9cebb22244.tar.gz chromium_src-ea0c98cfa2849f95bf40238c9f476c9cebb22244.tar.bz2 |
First draft of web resource service; fetches data from a JSON feed
and stores it in user prefs, where it can be used by the new tab page.
BUG = http://crbug.com/13363
Review URL: http://codereview.chromium.org/125052
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@18766 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/utility/utility_thread.cc')
-rw-r--r-- | chrome/utility/utility_thread.cc | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/chrome/utility/utility_thread.cc b/chrome/utility/utility_thread.cc index d1d7b37..46815b1 100644 --- a/chrome/utility/utility_thread.cc +++ b/chrome/utility/utility_thread.cc @@ -6,6 +6,7 @@ #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/render_messages.h" @@ -29,6 +30,7 @@ void UtilityThread::CleanUp() { 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_END_MESSAGE_MAP() } @@ -43,3 +45,20 @@ void UtilityThread::OnUnpackExtension(const FilePath& extension_path) { ChildProcess::current()->ReleaseProcess(); } + +void UtilityThread::OnUnpackWebResource(const std::string& resource_data) { + // Parse json data. + // TODO(mrc): Add the possibility of a template that controls parsing, and + // the ability to download and verify images. + WebResourceUnpacker unpacker(resource_data); + if (unpacker.Run()) { + Send(new UtilityHostMsg_UnpackWebResource_Succeeded( + *unpacker.parsed_json())); + } else { + Send(new UtilityHostMsg_UnpackWebResource_Failed( + unpacker.error_message())); + } + + ChildProcess::current()->ReleaseProcess(); +} + |