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

Side by Side Diff: chrome/browser/gaia_userinfo/image_decoder.h

Issue 8511064: GAIA Profile info prototype (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: test Created 9 years, 1 month 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/gaia_userinfo/image_decoder.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_GAIA_USERINFO_IMAGE_DECODER_H_
6 #define CHROME_BROWSER_GAIA_USERINFO_IMAGE_DECODER_H_
7 #pragma once
8
9 #include <string>
10 #include <vector>
11
12 #include "content/browser/utility_process_host.h"
13
14 class SkBitmap;
15
16 // Decodes an image in a sandboxed process.
17 class ImageDecoder : public UtilityProcessHost::Client {
18 public:
19 class Delegate {
20 public:
21 // Called when image is decoded.
22 // |decoder| is used to identify the image in case of decoding several
23 // images simultaneously.
24 virtual void OnImageDecoded(const ImageDecoder* decoder,
25 const SkBitmap& decoded_image) = 0;
26
27 // Called when decoding image failed. Delegate can do some cleanup in
28 // this handler.
29 virtual void OnDecodeImageFailed(const ImageDecoder* decoder) {}
30
31 protected:
32 virtual ~Delegate() {}
33 };
34
35 ImageDecoder(Delegate* delegate,
36 const std::string& image_data);
37
38 // Starts image decoding.
39 void Start();
40
41 private:
42 // It's a reference counted object, so destructor is private.
43 virtual ~ImageDecoder();
44
45 // Overidden from UtilityProcessHost::Client:
46 virtual bool OnMessageReceived(const IPC::Message& message);
47
48 // IPC message handlers.
49 void OnDecodeImageSucceeded(const SkBitmap& decoded_image);
50 void OnDecodeImageFailed();
51
52 // Launches sandboxed process that will decode the image.
53 void DecodeImageInSandbox(const std::vector<unsigned char>& image_data);
54
55 Delegate* delegate_;
56 std::vector<unsigned char> image_data_;
57 content::BrowserThread::ID target_thread_id_;
58
59 DISALLOW_COPY_AND_ASSIGN(ImageDecoder);
60 };
61
62 #endif // CHROME_BROWSER_GAIA_USERINFO_IMAGE_DECODER_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/gaia_userinfo/image_decoder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698