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

Side by Side Diff: chrome/browser/ui/webui/options2/chromeos/simple_png_encoder.h

Issue 10790084: Refactor the wallpaper encoding to another file/class. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 5 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | chrome/browser/ui/webui/options2/chromeos/simple_png_encoder.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) 2012 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_UI_WEBUI_OPTIONS2_CHROMEOS_SIMPLE_PNG_ENCODER_H_
6 #define CHROME_BROWSER_UI_WEBUI_OPTIONS2_CHROMEOS_SIMPLE_PNG_ENCODER_H_
7
8 #include "base/callback.h"
9 #include "base/compiler_specific.h"
10 #include "base/memory/ref_counted_memory.h"
11 #include "base/synchronization/cancellation_flag.h"
12 #include "third_party/skia/include/core/SkBitmap.h"
13
14 namespace chromeos {
15
16 typedef base::Callback<void(
17 scoped_refptr<base::RefCountedBytes>)> EncoderCallback;
18
19 // Operation class that encodes existing in-memory image as PNG.
20 // It uses NO-COMPRESSION to save time.
21 class SimplePngEncoder
22 : public base::RefCountedThreadSafe<SimplePngEncoder> {
23 public:
24 SimplePngEncoder(scoped_refptr<base::RefCountedBytes> data,
25 SkBitmap image,
26 base::Closure cancel_callback);
27
28 void Run(EncoderCallback callback);
29
30 void EncodeWallpaper();
31 void Cancel();
32
33 private:
34 friend class base::RefCountedThreadSafe<SimplePngEncoder>;
35
36 ~SimplePngEncoder();
37
38 base::CancellationFlag cancel_flag_;
39
40 // Buffer to store encoded image.
41 scoped_refptr<base::RefCountedBytes> data_;
42 // Original image to encode.
43 SkBitmap image_;
44 base::Closure cancel_callback_;
45
46 DISALLOW_COPY_AND_ASSIGN(SimplePngEncoder);
47 };
48
49 } // namespace chromeos
50
51 #endif // CHROME_BROWSER_UI_WEBUI_OPTIONS2_CHROMEOS_SIMPLE_PNG_ENCODER_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/webui/options2/chromeos/simple_png_encoder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698