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

Side by Side Diff: chrome/browser/chromeos/login/simple_jpeg_encoder.h

Issue 10883062: Resize and save custom wallpaper to large and small size (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge to trunk Created 8 years, 3 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
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_CHROMEOS_LOGIN_SIMPLE_JPEG_ENCODER_H_
6 #define CHROME_BROWSER_CHROMEOS_LOGIN_SIMPLE_JPEG_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 // Operation class that encodes existing in-memory image as JPEG.
17 class SimpleJpegEncoder
18 : public base::RefCountedThreadSafe<SimpleJpegEncoder> {
19 public:
20 // This callback is called after encoding to JPEG completes.
21 typedef base::Callback<void(
22 scoped_refptr<base::RefCountedBytes>)> EncoderCallback;
23
24 SimpleJpegEncoder(scoped_refptr<base::RefCountedBytes> data,
25 SkBitmap image);
26
27 // Starts encoding task on worker pool.
28 void Run(EncoderCallback callback);
29
30 // Cancels encoding task when possible.
31 void Cancel();
32
33 private:
34 friend class base::RefCountedThreadSafe<SimpleJpegEncoder>;
35
36 ~SimpleJpegEncoder();
37
38 // Encodes a SkBitmap with JPEG codec on worker pool.
39 void EncodeWallpaper();
40
41 base::CancellationFlag cancel_flag_;
42
43 // Buffer to store encoded image.
44 scoped_refptr<base::RefCountedBytes> data_;
45 // Original image to encode.
46 SkBitmap image_;
47
48 DISALLOW_COPY_AND_ASSIGN(SimpleJpegEncoder);
49 };
50
51 } // namespace chromeos
52
53 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_SIMPLE_JPEG_ENCODER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698