Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2014 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_ANDROID_THUMBNAIL_THUMBNAIL_H_ | |
| 6 #define CHROME_BROWSER_ANDROID_THUMBNAIL_THUMBNAIL_H_ | |
| 7 | |
| 8 #include "base/memory/ref_counted.h" | |
| 9 #include "base/time/time.h" | |
| 10 #include "cc/resources/ui_resource_bitmap.h" | |
| 11 #include "cc/resources/ui_resource_client.h" | |
| 12 #include "content/public/browser/android/ui_resource_client_android.h" | |
| 13 #include "ui/gfx/geometry/size.h" | |
| 14 | |
| 15 namespace base { | |
| 16 class Time; | |
| 17 } | |
| 18 | |
| 19 namespace content { | |
| 20 class UIResourceProvider; | |
| 21 } | |
| 22 | |
| 23 namespace gfx { | |
| 24 class Size; | |
| 25 } | |
| 26 | |
| 27 typedef int TabId; | |
| 28 | |
| 29 class Thumbnail; | |
| 30 | |
| 31 class ThumbnailManager { | |
|
David Trainor- moved to gerrit
2014/07/14 20:30:45
ThumbnailDelegate maybe?
powei
2014/07/15 20:06:09
Done.
| |
| 32 public: | |
| 33 virtual void InvalidateCachedThumbnail(const Thumbnail& thumbnail) = 0; | |
| 34 virtual ~ThumbnailManager() {} | |
| 35 }; | |
| 36 | |
| 37 class Thumbnail : public content::UIResourceClientAndroid { | |
| 38 public: | |
| 39 Thumbnail(); | |
| 40 Thumbnail(TabId tab_id, | |
| 41 const base::Time& time_stamp, | |
| 42 float scale, | |
| 43 content::UIResourceProvider* ui_resource_provider, | |
| 44 ThumbnailManager* thumbnail_manager); | |
| 45 ~Thumbnail(); | |
| 46 | |
| 47 TabId tab_id() const { return tab_id_; } | |
| 48 base::Time time_stamp() const { return time_stamp_; } | |
| 49 float scale() const { return scale_; } | |
| 50 cc::UIResourceId ui_resource_id() const { return ui_resource_id_; } | |
| 51 gfx::SizeF GetScaledContentSize() const { return scaled_content_size_; } | |
|
David Trainor- moved to gerrit
2014/07/14 20:30:46
const gfx::SizeF& and scaled_content_size (or put
powei
2014/07/15 20:06:09
Done.
| |
| 52 gfx::SizeF GetScaledDataSize() const { return scaled_data_size_; } | |
| 53 | |
| 54 void SetBitmap(const SkBitmap& bitmap); | |
| 55 void SetCompressedBitmap(skia::RefPtr<SkPixelRef> compressed_bitmap, | |
| 56 gfx::Size content_size); | |
|
David Trainor- moved to gerrit
2014/07/14 20:30:45
const gfx::Size&
powei
2014/07/15 20:06:09
Done.
| |
| 57 void CreateUIResource(); | |
| 58 | |
| 59 // content::UIResourceClient implementation. | |
| 60 virtual cc::UIResourceBitmap GetBitmap(cc::UIResourceId uid, | |
| 61 bool resource_lost) OVERRIDE; | |
| 62 | |
| 63 // content::UIResourceClientAndroid implementation. | |
| 64 virtual void UIResourceIsInvalid() OVERRIDE; | |
| 65 | |
| 66 Thumbnail& operator=(const Thumbnail& rhs); | |
| 67 | |
| 68 protected: | |
| 69 void ClearUIResourceId(); | |
| 70 | |
| 71 TabId tab_id_; | |
| 72 base::Time time_stamp_; | |
| 73 float scale_; | |
| 74 | |
| 75 gfx::SizeF scaled_content_size_; | |
| 76 gfx::SizeF scaled_data_size_; | |
| 77 | |
| 78 cc::UIResourceBitmap bitmap_; | |
| 79 cc::UIResourceId ui_resource_id_; | |
| 80 | |
| 81 bool retrieved_; | |
| 82 | |
| 83 content::UIResourceProvider* ui_resource_provider_; | |
| 84 ThumbnailManager* thumbnail_manager_; | |
| 85 }; | |
| 86 | |
| 87 #endif // CHROME_BROWSER_ANDROID_THUMBNAIL_THUMBNAIL_H_ | |
| OLD | NEW |