Chromium Code Reviews| Index: chrome/browser/chromeos/login/simple_png_encoder.h |
| diff --git a/chrome/browser/chromeos/login/simple_png_encoder.h b/chrome/browser/chromeos/login/simple_png_encoder.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..ad9525324ba68a3ea02d750b4ace2dc7a44eb747 |
| --- /dev/null |
| +++ b/chrome/browser/chromeos/login/simple_png_encoder.h |
| @@ -0,0 +1,49 @@ |
| +// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#ifndef CHROME_BROWSER_CHROMEOS_LOGIN_SIMPLE_PNG_ENCODER_H_ |
| +#define CHROME_BROWSER_CHROMEOS_LOGIN_SIMPLE_PNG_ENCODER_H_ |
| + |
| +#include "base/callback.h" |
| +#include "base/compiler_specific.h" |
| +#include "base/memory/ref_counted_memory.h" |
| +#include "base/synchronization/cancellation_flag.h" |
| +#include "third_party/skia/include/core/SkBitmap.h" |
| + |
| +namespace chromeos { |
| + |
| +typedef base::Callback<void( |
|
Ivan Korotkov
2012/08/28 16:16:13
Since this name is pretty generic, please move it
bshe
2012/08/29 14:30:07
Done.
|
| + scoped_refptr<base::RefCountedBytes>)> EncoderCallback; |
| + |
| +// Operation class that encodes existing in-memory image as PNG. |
| +// It uses NO-COMPRESSION to save time. |
| +class SimplePngEncoder |
| + : public base::RefCountedThreadSafe<SimplePngEncoder> { |
| + public: |
| + SimplePngEncoder(scoped_refptr<base::RefCountedBytes> data, |
| + SkBitmap image); |
| + |
| + void Run(EncoderCallback callback); |
|
Ivan Korotkov
2012/08/28 16:16:13
Please document these functions.
bshe
2012/08/29 14:30:07
Done.
|
| + |
| + void EncodeWallpaper(); |
|
Ivan Korotkov
2012/08/28 16:16:13
Looks like it doesn't need to be public.
bshe
2012/08/29 14:30:07
Moved to private.
On 2012/08/28 16:16:13, Ivan Ko
|
| + void Cancel(); |
| + |
| + private: |
| + friend class base::RefCountedThreadSafe<SimplePngEncoder>; |
| + |
| + ~SimplePngEncoder(); |
| + |
| + base::CancellationFlag cancel_flag_; |
| + |
| + // Buffer to store encoded image. |
| + scoped_refptr<base::RefCountedBytes> data_; |
| + // Original image to encode. |
| + SkBitmap image_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(SimplePngEncoder); |
| +}; |
| + |
| +} // namespace chromeos |
| + |
| +#endif // CHROME_BROWSER_CHROMEOS_LOGIN_SIMPLE_PNG_ENCODER_H_ |