Chromium Code Reviews| Index: chrome/browser/thumbnails/thumbnailing_algorithm.h |
| diff --git a/chrome/browser/thumbnails/thumbnailing_algorithm.h b/chrome/browser/thumbnails/thumbnailing_algorithm.h |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..421c12f1a6320ea4add81ae4300bf599cdf4309a |
| --- /dev/null |
| +++ b/chrome/browser/thumbnails/thumbnailing_algorithm.h |
| @@ -0,0 +1,48 @@ |
| +// Copyright (c) 2013 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_THUMBNAILS_THUMBNAILING_ALGORITHM_H_ |
| +#define CHROME_BROWSER_THUMBNAILS_THUMBNAILING_ALGORITHM_H_ |
| + |
| +#include "base/memory/ref_counted.h" |
| +#include "chrome/browser/thumbnails/thumbnailing_context.h" |
| +#include "ui/gfx/rect.h" |
| +#include "ui/gfx/size.h" |
| + |
| +class SkBitmap; |
| + |
| +namespace thumbnails { |
| + |
| +// An interface abstracting thumbnailing algorithms. Instances are intended to |
| +// be created by ThumbnailService's implementations and used by |
| +// ThumbnailTabHelper as consumers of captured source images. |
| +class ThumbnailingAlgorithm |
| + : public base::RefCountedThreadSafe<ThumbnailingAlgorithm> { |
| + public: |
| + typedef base::Callback<void(ThumbnailingContext*, const SkBitmap&)> |
| + ConsumerCallback; |
| + // Provides information necessary to crop-and-resize image data from a source |
| + // canvas of |source_size|. Auxiliary |scale_factor| helps compute the target |
| + // thumbnail size. Parameters of the required copy operation are assigned to |
| + // |clipping_rect| (cropping rectangle for the source canvas) and |
| + // |target_size| (the size of the target bitmap). |
| + // The return value indicates the type of clipping that will be done. |
| + virtual ClipResult GetCanvasCopyInfo(const gfx::Size& source_size, |
| + ui::ScaleFactor scale_factor, |
| + gfx::Rect* clipping_rect, |
| + gfx::Size* target_size) const = 0; |
| + |
| + |
| + virtual void ProcessBitmap(ThumbnailingContext* context, |
|
mazda
2013/01/17 18:08:43
Please add a comment.
motek.
2013/01/17 18:39:42
Done.
|
| + const SkBitmap& bitmap, |
| + const ConsumerCallback& callback) = 0; |
| + |
| + protected: |
| + virtual ~ThumbnailingAlgorithm() {} |
| + friend class base::RefCountedThreadSafe<ThumbnailingAlgorithm>; |
| +}; |
| + |
| +} |
| + |
| +#endif // CHROME_BROWSER_THUMBNAILS_THUMBNAILING_ALGORITHM_H_ |