| Index: chrome/browser/android/thumbnail/thumbnail_impl.h
|
| diff --git a/chrome/browser/android/thumbnail/thumbnail_impl.h b/chrome/browser/android/thumbnail/thumbnail_impl.h
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..c550337a31c84e5bf4478aafc7a68b86159b9bbc
|
| --- /dev/null
|
| +++ b/chrome/browser/android/thumbnail/thumbnail_impl.h
|
| @@ -0,0 +1,91 @@
|
| +// Copyright 2014 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_ANDROID_THUMBNAIL_THUMBNAIL_IMPL_H_
|
| +#define CHROME_BROWSER_ANDROID_THUMBNAIL_THUMBNAIL_IMPL_H_
|
| +
|
| +#include "chrome/browser/android/thumbnail/thumbnail.h"
|
| +#include "content/public/browser/android/ui_resource_client_android.h"
|
| +#include "skia/ext/refptr.h"
|
| +#include "third_party/skia/include/core/SkBitmap.h"
|
| +#include "ui/gfx/geometry/size.h"
|
| +#include "ui/gfx/geometry/size_f.h"
|
| +
|
| +class ThumbnailCache;
|
| +
|
| +namespace base {
|
| +class File;
|
| +}
|
| +
|
| +namespace content {
|
| +class UIResourceProvider;
|
| +}
|
| +
|
| +class ThumbnailImpl;
|
| +class ThumbnailImplManager {
|
| + public:
|
| + virtual void InvalidateCachedThumbnail(
|
| + scoped_refptr<ThumbnailImpl> thumbnail) = 0;
|
| + virtual ~ThumbnailImplManager() {}
|
| +};
|
| +
|
| +class ThumbnailImpl : public Thumbnail,
|
| + public content::UIResourceClientAndroid {
|
| + public:
|
| + ThumbnailImpl(TabId tab_id,
|
| + const SkBitmap& bitmap,
|
| + float scale,
|
| + ThumbnailImplManager* thumbnail_impl_manager,
|
| + content::UIResourceProvider* ui_resource_provider);
|
| + bool IsValid() const;
|
| +
|
| + // Thumbnail implementation.
|
| + virtual gfx::Size GetScaledContentSize() const OVERRIDE;
|
| + virtual gfx::SizeF GetScaledDataSize() const OVERRIDE;
|
| + virtual cc::UIResourceId ui_resource_id() const OVERRIDE {
|
| + return ui_resource_id_;
|
| + }
|
| + virtual TabId tab_id() const OVERRIDE { return tab_id_; }
|
| +
|
| + static void Compress(scoped_refptr<ThumbnailImpl> in_thumbnail,
|
| + scoped_refptr<ThumbnailImpl> out_thumbnail);
|
| + static bool WriteToFile(scoped_refptr<ThumbnailImpl> thumbnail,
|
| + base::File& file);
|
| + static bool ReadFromFile(base::File& file,
|
| + scoped_refptr<ThumbnailImpl> thumbnail);
|
| +
|
| + scoped_refptr<ThumbnailImpl> PassDataToNewThumbnail();
|
| +
|
| + // content::UIResourceClient implementation.
|
| + virtual cc::UIResourceBitmap GetBitmap(cc::UIResourceId uid,
|
| + bool resource_lost) OVERRIDE;
|
| +
|
| + // content::UIResourceClientAndroid implementation.
|
| + virtual void UIResourceIsInvalid() OVERRIDE;
|
| +
|
| + protected:
|
| + virtual ~ThumbnailImpl();
|
| +
|
| + private:
|
| + void CleanupUIResource();
|
| + void BuildUIResource();
|
| + void SetRawData(SkBitmap bitmap, float scale);
|
| + void SetCompressedData(skia::RefPtr<SkPixelRef> compressed_data,
|
| + float scale,
|
| + const gfx::Size& content_size);
|
| + TabId tab_id_;
|
| + cc::UIResourceId ui_resource_id_;
|
| + SkBitmap raw_data_;
|
| + skia::RefPtr<SkPixelRef> compressed_data_;
|
| + float scale_;
|
| + gfx::Size data_size_;
|
| + gfx::Size content_size_;
|
| +
|
| + ThumbnailImplManager* thumbnail_impl_manager_;
|
| + content::UIResourceProvider* ui_resource_provider_;
|
| +
|
| + DISALLOW_COPY_AND_ASSIGN(ThumbnailImpl);
|
| +};
|
| +
|
| +#endif // CHROME_BROWSER_ANDROID_THUMBNAIL_THUMBNAIL_IMPL_H_
|
|
|