OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CHROME_BROWSER_ANDROID_THUMBNAIL_THUMBNAIL_STORE_H_ | 5 #ifndef CHROME_BROWSER_ANDROID_THUMBNAIL_THUMBNAIL_STORE_H_ |
6 #define CHROME_BROWSER_ANDROID_THUMBNAIL_THUMBNAIL_STORE_H_ | 6 #define CHROME_BROWSER_ANDROID_THUMBNAIL_THUMBNAIL_STORE_H_ |
7 | 7 |
8 #include <list> | 8 #include <list> |
9 #include <set> | 9 #include <set> |
10 #include <string> | 10 #include <string> |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 | 43 |
44 class ThumbnailStore : ThumbnailDelegate { | 44 class ThumbnailStore : ThumbnailDelegate { |
45 public: | 45 public: |
46 ThumbnailStore(const std::string& disk_cache_path_str, | 46 ThumbnailStore(const std::string& disk_cache_path_str, |
47 size_t default_cache_size, | 47 size_t default_cache_size, |
48 size_t approximation_cache_size, | 48 size_t approximation_cache_size, |
49 size_t compression_queue_max_size, | 49 size_t compression_queue_max_size, |
50 size_t write_queue_max_size, | 50 size_t write_queue_max_size, |
51 bool use_approximation_thumbnail); | 51 bool use_approximation_thumbnail); |
52 | 52 |
53 virtual ~ThumbnailStore(); | 53 ~ThumbnailStore() override; |
54 | 54 |
55 void SetUIResourceProvider(ui::UIResourceProvider* ui_resource_provider); | 55 void SetUIResourceProvider(ui::UIResourceProvider* ui_resource_provider); |
56 | 56 |
57 void AddThumbnailStoreObserver(ThumbnailStoreObserver* observer); | 57 void AddThumbnailStoreObserver(ThumbnailStoreObserver* observer); |
58 void RemoveThumbnailStoreObserver( | 58 void RemoveThumbnailStoreObserver( |
59 ThumbnailStoreObserver* observer); | 59 ThumbnailStoreObserver* observer); |
60 | 60 |
61 void Put(TabId tab_id, const SkBitmap& bitmap, float thumbnail_scale); | 61 void Put(TabId tab_id, const SkBitmap& bitmap, float thumbnail_scale); |
62 void Remove(TabId tab_id); | 62 void Remove(TabId tab_id); |
63 Thumbnail* Get(TabId tab_id, bool force_disk_read, bool allow_approximation); | 63 Thumbnail* Get(TabId tab_id, bool force_disk_read, bool allow_approximation); |
64 | 64 |
65 void RemoveFromDiskAtAndAboveId(TabId min_id); | 65 void RemoveFromDiskAtAndAboveId(TabId min_id); |
66 void InvalidateThumbnailIfChanged(TabId tab_id, const GURL& url); | 66 void InvalidateThumbnailIfChanged(TabId tab_id, const GURL& url); |
67 bool CheckAndUpdateThumbnailMetaData(TabId tab_id, const GURL& url); | 67 bool CheckAndUpdateThumbnailMetaData(TabId tab_id, const GURL& url); |
68 void UpdateVisibleIds(const TabIdList& priority); | 68 void UpdateVisibleIds(const TabIdList& priority); |
69 void DecompressThumbnailFromFile( | 69 void DecompressThumbnailFromFile( |
70 TabId tab_id, | 70 TabId tab_id, |
71 const base::Callback<void(bool, SkBitmap)>& | 71 const base::Callback<void(bool, SkBitmap)>& |
72 post_decompress_callback); | 72 post_decompress_callback); |
73 | 73 |
74 // ThumbnailDelegate implementation | 74 // ThumbnailDelegate implementation |
75 virtual void InvalidateCachedThumbnail(Thumbnail* thumbnail) override; | 75 void InvalidateCachedThumbnail(Thumbnail* thumbnail) override; |
76 | 76 |
77 private: | 77 private: |
78 class ThumbnailMetaData { | 78 class ThumbnailMetaData { |
79 public: | 79 public: |
80 ThumbnailMetaData(); | 80 ThumbnailMetaData(); |
81 ThumbnailMetaData(const base::Time& current_time, const GURL& url); | 81 ThumbnailMetaData(const base::Time& current_time, const GURL& url); |
82 const GURL& url() const { return url_; } | 82 const GURL& url() const { return url_; } |
83 base::Time capture_time() const { return capture_time_; } | 83 base::Time capture_time() const { return capture_time_; } |
84 | 84 |
85 private: | 85 private: |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 TabIdList visible_ids_; | 160 TabIdList visible_ids_; |
161 | 161 |
162 ui::UIResourceProvider* ui_resource_provider_; | 162 ui::UIResourceProvider* ui_resource_provider_; |
163 | 163 |
164 base::WeakPtrFactory<ThumbnailStore> weak_factory_; | 164 base::WeakPtrFactory<ThumbnailStore> weak_factory_; |
165 | 165 |
166 DISALLOW_COPY_AND_ASSIGN(ThumbnailStore); | 166 DISALLOW_COPY_AND_ASSIGN(ThumbnailStore); |
167 }; | 167 }; |
168 | 168 |
169 #endif // CHROME_BROWSER_ANDROID_THUMBNAIL_THUMBNAIL_STORE_H_ | 169 #endif // CHROME_BROWSER_ANDROID_THUMBNAIL_THUMBNAIL_STORE_H_ |
OLD | NEW |