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> |
11 | 11 |
12 #include "base/bind.h" | 12 #include "base/bind.h" |
13 #include "base/containers/hash_tables.h" | 13 #include "base/containers/hash_tables.h" |
14 #include "base/files/file_path.h" | 14 #include "base/files/file_path.h" |
15 #include "base/memory/ref_counted.h" | 15 #include "base/memory/ref_counted.h" |
16 #include "base/observer_list.h" | 16 #include "base/observer_list.h" |
17 #include "base/time/time.h" | 17 #include "base/time/time.h" |
18 #include "chrome/browser/android/thumbnail/scoped_ptr_expiring_cache.h" | 18 #include "chrome/browser/android/thumbnail/scoped_ptr_expiring_cache.h" |
19 #include "chrome/browser/android/thumbnail/thumbnail.h" | 19 #include "chrome/browser/android/thumbnail/thumbnail.h" |
20 #include "content/public/browser/android/ui_resource_client_android.h" | |
21 #include "content/public/browser/android/ui_resource_provider.h" | |
22 #include "third_party/skia/include/core/SkBitmap.h" | 20 #include "third_party/skia/include/core/SkBitmap.h" |
| 21 #include "ui/android/resources/ui_resource_client_android.h" |
| 22 #include "ui/android/resources/ui_resource_provider.h" |
23 #include "ui/gfx/geometry/point.h" | 23 #include "ui/gfx/geometry/point.h" |
24 #include "ui/gfx/geometry/size.h" | 24 #include "ui/gfx/geometry/size.h" |
25 #include "ui/gfx/geometry/size_f.h" | 25 #include "ui/gfx/geometry/size_f.h" |
26 #include "url/gurl.h" | 26 #include "url/gurl.h" |
27 | 27 |
28 namespace base { | 28 namespace base { |
29 class File; | 29 class File; |
30 class Time; | 30 class Time; |
31 } | 31 } |
32 | 32 |
(...skipping 12 matching lines...) Expand all Loading... |
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 virtual ~ThumbnailStore(); |
54 | 54 |
55 void SetUIResourceProvider(content::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); |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
152 size_t write_tasks_count_; | 152 size_t write_tasks_count_; |
153 bool read_in_progress_; | 153 bool read_in_progress_; |
154 | 154 |
155 ExpiringThumbnailCache cache_; | 155 ExpiringThumbnailCache cache_; |
156 ExpiringThumbnailCache approximation_cache_; | 156 ExpiringThumbnailCache approximation_cache_; |
157 ObserverList<ThumbnailStoreObserver> observers_; | 157 ObserverList<ThumbnailStoreObserver> observers_; |
158 ThumbnailMetaDataMap thumbnail_meta_data_; | 158 ThumbnailMetaDataMap thumbnail_meta_data_; |
159 TabIdList read_queue_; | 159 TabIdList read_queue_; |
160 TabIdList visible_ids_; | 160 TabIdList visible_ids_; |
161 | 161 |
162 content::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 |