diff options
author | avayvod@google.com <avayvod@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-04-15 18:31:22 +0000 |
---|---|---|
committer | avayvod@google.com <avayvod@google.com@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-04-15 18:31:22 +0000 |
commit | 79c2b56bcad7b23ccc25d2bc934887ea080b7a9d (patch) | |
tree | efc45fa2d3e5250849972bf90510f39efc7ec93d /chrome/browser | |
parent | 26cfaf5d657b92f5f94eccc0a0b51c28caccbc5a (diff) | |
download | chromium_src-79c2b56bcad7b23ccc25d2bc934887ea080b7a9d.zip chromium_src-79c2b56bcad7b23ccc25d2bc934887ea080b7a9d.tar.gz chromium_src-79c2b56bcad7b23ccc25d2bc934887ea080b7a9d.tar.bz2 |
Added decoding of any supported image format into vector of chars.
This is used for decoding user's image downloaded from Google Profile
in sandboxed process upon user's login to Chromium OS.
This required adding dependency on webkit/glue/ in chrome/utility. Approved
by Brett.
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/1646004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@44675 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser')
-rw-r--r-- | chrome/browser/utility_process_host.cc | 13 | ||||
-rw-r--r-- | chrome/browser/utility_process_host.h | 13 |
2 files changed, 26 insertions, 0 deletions
diff --git a/chrome/browser/utility_process_host.cc b/chrome/browser/utility_process_host.cc index 1766b7e..2f7ce5d 100644 --- a/chrome/browser/utility_process_host.cc +++ b/chrome/browser/utility_process_host.cc @@ -51,6 +51,15 @@ bool UtilityProcessHost::StartUpdateManifestParse(const std::string& xml) { return true; } +bool UtilityProcessHost::StartImageDecoding( + const std::vector<unsigned char>& encoded_data) { + if (!StartProcess(FilePath())) + return false; + + Send(new UtilityMsg_DecodeImage(encoded_data)); + return true; +} + FilePath UtilityProcessHost::GetUtilityProcessCmd() { return GetChildPath(true); } @@ -146,5 +155,9 @@ void UtilityProcessHost::Client::OnMessageReceived( Client::OnParseUpdateManifestSucceeded) IPC_MESSAGE_HANDLER(UtilityHostMsg_ParseUpdateManifest_Failed, Client::OnParseUpdateManifestFailed) + IPC_MESSAGE_HANDLER(UtilityHostMsg_DecodeImage_Succeeded, + Client::OnDecodeImageSucceeded) + IPC_MESSAGE_HANDLER(UtilityHostMsg_DecodeImage_Failed, + Client::OnDecodeImageFailed) IPC_END_MESSAGE_MAP_EX() } diff --git a/chrome/browser/utility_process_host.h b/chrome/browser/utility_process_host.h index ab326e8..faeec97 100644 --- a/chrome/browser/utility_process_host.h +++ b/chrome/browser/utility_process_host.h @@ -6,6 +6,7 @@ #define CHROME_BROWSER_UTILITY_PROCESS_HOST_H_ #include <string> +#include <vector> #include "base/basictypes.h" #include "base/ref_counted.h" @@ -14,6 +15,7 @@ #include "chrome/browser/chrome_thread.h" #include "chrome/common/extensions/update_manifest.h" #include "ipc/ipc_channel.h" +#include "third_party/skia/include/core/SkBitmap.h" class CommandLine; class DictionaryValue; @@ -63,6 +65,14 @@ class UtilityProcessHost : public ChildProcessHost { virtual void OnParseUpdateManifestFailed( const std::string& error_message) {} + // Called when image data was successfully decoded. |decoded_image| + // stores the result. + virtual void OnDecodeImageSucceeded( + const SkBitmap& decoded_image) {} + + // Called when image data decoding failed. + virtual void OnDecodeImageFailed() {} + protected: friend class base::RefCountedThreadSafe<Client>; @@ -97,6 +107,9 @@ class UtilityProcessHost : public ChildProcessHost { // Start parsing an extensions auto-update manifest xml file. bool StartUpdateManifestParse(const std::string& xml); + // Start image decoding. + bool StartImageDecoding(const std::vector<unsigned char>& encoded_data); + protected: // Allow these methods to be overridden for tests. virtual FilePath GetUtilityProcessCmd(); |