OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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_SYNC_GLUE_FAVICON_CACHE_H_ | 5 #ifndef CHROME_BROWSER_SYNC_GLUE_FAVICON_CACHE_H_ |
6 #define CHROME_BROWSER_SYNC_GLUE_FAVICON_CACHE_H_ | 6 #define CHROME_BROWSER_SYNC_GLUE_FAVICON_CACHE_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 public content::NotificationObserver { | 49 public content::NotificationObserver { |
50 public: | 50 public: |
51 FaviconCache(Profile* profile, int max_sync_favicon_limit); | 51 FaviconCache(Profile* profile, int max_sync_favicon_limit); |
52 virtual ~FaviconCache(); | 52 virtual ~FaviconCache(); |
53 | 53 |
54 // SyncableService implementation. | 54 // SyncableService implementation. |
55 virtual syncer::SyncMergeResult MergeDataAndStartSyncing( | 55 virtual syncer::SyncMergeResult MergeDataAndStartSyncing( |
56 syncer::ModelType type, | 56 syncer::ModelType type, |
57 const syncer::SyncDataList& initial_sync_data, | 57 const syncer::SyncDataList& initial_sync_data, |
58 scoped_ptr<syncer::SyncChangeProcessor> sync_processor, | 58 scoped_ptr<syncer::SyncChangeProcessor> sync_processor, |
59 scoped_ptr<syncer::SyncErrorFactory> error_handler) OVERRIDE; | 59 scoped_ptr<syncer::SyncErrorFactory> error_handler) override; |
60 virtual void StopSyncing(syncer::ModelType type) OVERRIDE; | 60 virtual void StopSyncing(syncer::ModelType type) override; |
61 virtual syncer::SyncDataList GetAllSyncData(syncer::ModelType type) | 61 virtual syncer::SyncDataList GetAllSyncData(syncer::ModelType type) |
62 const OVERRIDE; | 62 const override; |
63 virtual syncer::SyncError ProcessSyncChanges( | 63 virtual syncer::SyncError ProcessSyncChanges( |
64 const tracked_objects::Location& from_here, | 64 const tracked_objects::Location& from_here, |
65 const syncer::SyncChangeList& change_list) OVERRIDE; | 65 const syncer::SyncChangeList& change_list) override; |
66 | 66 |
67 // If a valid favicon for the icon at |favicon_url| is found, fills | 67 // If a valid favicon for the icon at |favicon_url| is found, fills |
68 // |favicon_png| with the png-encoded image and returns true. Else, returns | 68 // |favicon_png| with the png-encoded image and returns true. Else, returns |
69 // false. | 69 // false. |
70 bool GetSyncedFaviconForFaviconURL( | 70 bool GetSyncedFaviconForFaviconURL( |
71 const GURL& favicon_url, | 71 const GURL& favicon_url, |
72 scoped_refptr<base::RefCountedMemory>* favicon_png) const; | 72 scoped_refptr<base::RefCountedMemory>* favicon_png) const; |
73 | 73 |
74 // If a valid favicon for the icon associated with |page_url| is found, fills | 74 // If a valid favicon for the icon associated with |page_url| is found, fills |
75 // |favicon_png| with the png-encoded image and returns true. Else, returns | 75 // |favicon_png| with the png-encoded image and returns true. Else, returns |
(...skipping 17 matching lines...) Expand all Loading... |
93 // If |icon_bytes| is empty, only updates the page->favicon url mapping. | 93 // If |icon_bytes| is empty, only updates the page->favicon url mapping. |
94 // Safe to call within a transaction. | 94 // Safe to call within a transaction. |
95 void OnReceivedSyncFavicon(const GURL& page_url, | 95 void OnReceivedSyncFavicon(const GURL& page_url, |
96 const GURL& icon_url, | 96 const GURL& icon_url, |
97 const std::string& icon_bytes, | 97 const std::string& icon_bytes, |
98 int64 visit_time_ms); | 98 int64 visit_time_ms); |
99 | 99 |
100 // NotificationObserver implementation. | 100 // NotificationObserver implementation. |
101 virtual void Observe(int type, | 101 virtual void Observe(int type, |
102 const content::NotificationSource& source, | 102 const content::NotificationSource& source, |
103 const content::NotificationDetails& details) OVERRIDE; | 103 const content::NotificationDetails& details) override; |
104 | 104 |
105 private: | 105 private: |
106 friend class SyncFaviconCacheTest; | 106 friend class SyncFaviconCacheTest; |
107 | 107 |
108 // Functor for ordering SyncedFaviconInfo objects by recency; | 108 // Functor for ordering SyncedFaviconInfo objects by recency; |
109 struct FaviconRecencyFunctor { | 109 struct FaviconRecencyFunctor { |
110 bool operator()(const linked_ptr<SyncedFaviconInfo>& lhs, | 110 bool operator()(const linked_ptr<SyncedFaviconInfo>& lhs, |
111 const linked_ptr<SyncedFaviconInfo>& rhs) const; | 111 const linked_ptr<SyncedFaviconInfo>& rhs) const; |
112 }; | 112 }; |
113 | 113 |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
229 | 229 |
230 // Weak pointer factory for favicon loads. | 230 // Weak pointer factory for favicon loads. |
231 base::WeakPtrFactory<FaviconCache> weak_ptr_factory_; | 231 base::WeakPtrFactory<FaviconCache> weak_ptr_factory_; |
232 | 232 |
233 DISALLOW_COPY_AND_ASSIGN(FaviconCache); | 233 DISALLOW_COPY_AND_ASSIGN(FaviconCache); |
234 }; | 234 }; |
235 | 235 |
236 } // namespace browser_sync | 236 } // namespace browser_sync |
237 | 237 |
238 #endif // CHROME_BROWSER_SYNC_GLUE_FAVICON_CACHE_H_ | 238 #endif // CHROME_BROWSER_SYNC_GLUE_FAVICON_CACHE_H_ |
OLD | NEW |