| 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 10 matching lines...) Expand all Loading... |
| 21 #include "content/public/browser/notification_observer.h" | 21 #include "content/public/browser/notification_observer.h" |
| 22 #include "content/public/browser/notification_registrar.h" | 22 #include "content/public/browser/notification_registrar.h" |
| 23 #include "sync/api/sync_change.h" | 23 #include "sync/api/sync_change.h" |
| 24 #include "sync/api/sync_error_factory.h" | 24 #include "sync/api/sync_error_factory.h" |
| 25 #include "sync/api/syncable_service.h" | 25 #include "sync/api/syncable_service.h" |
| 26 #include "url/gurl.h" | 26 #include "url/gurl.h" |
| 27 | 27 |
| 28 class Profile; | 28 class Profile; |
| 29 | 29 |
| 30 namespace chrome { | 30 namespace chrome { |
| 31 struct FaviconBitmapResult; | 31 struct FaviconRawBitmapResult; |
| 32 } | 32 } |
| 33 | 33 |
| 34 namespace browser_sync { | 34 namespace browser_sync { |
| 35 | 35 |
| 36 enum IconSize { | 36 enum IconSize { |
| 37 SIZE_INVALID, | 37 SIZE_INVALID, |
| 38 SIZE_16, | 38 SIZE_16, |
| 39 SIZE_32, | 39 SIZE_32, |
| 40 SIZE_64, | 40 SIZE_64, |
| 41 NUM_SIZES | 41 NUM_SIZES |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 124 // Helper method to perform OnReceivedSyncFavicon work without worrying about | 124 // Helper method to perform OnReceivedSyncFavicon work without worrying about |
| 125 // whether caller holds a sync transaction. | 125 // whether caller holds a sync transaction. |
| 126 void OnReceivedSyncFaviconImpl(const GURL& icon_url, | 126 void OnReceivedSyncFaviconImpl(const GURL& icon_url, |
| 127 const std::string& icon_bytes, | 127 const std::string& icon_bytes, |
| 128 int64 visit_time_ms); | 128 int64 visit_time_ms); |
| 129 | 129 |
| 130 // Callback method to store a tab's favicon into its sync node once it becomes | 130 // Callback method to store a tab's favicon into its sync node once it becomes |
| 131 // available. Does nothing if no favicon data was available. | 131 // available. Does nothing if no favicon data was available. |
| 132 void OnFaviconDataAvailable( | 132 void OnFaviconDataAvailable( |
| 133 const GURL& page_url, | 133 const GURL& page_url, |
| 134 const std::vector<favicon_base::FaviconBitmapResult>& bitmap_result); | 134 const std::vector<favicon_base::FaviconRawBitmapResult>& bitmap_result); |
| 135 | 135 |
| 136 // Helper method to update the sync state of the favicon at |icon_url|. If | 136 // Helper method to update the sync state of the favicon at |icon_url|. If |
| 137 // either |image_change_type| or |tracking_change_type| is ACTION_INVALID, | 137 // either |image_change_type| or |tracking_change_type| is ACTION_INVALID, |
| 138 // the corresponding datatype won't be updated. | 138 // the corresponding datatype won't be updated. |
| 139 // Note: should only be called after both FAVICON_IMAGES and FAVICON_TRACKING | 139 // Note: should only be called after both FAVICON_IMAGES and FAVICON_TRACKING |
| 140 // have been successfully set up. | 140 // have been successfully set up. |
| 141 void UpdateSyncState(const GURL& icon_url, | 141 void UpdateSyncState(const GURL& icon_url, |
| 142 syncer::SyncChange::SyncChangeType image_change_type, | 142 syncer::SyncChange::SyncChangeType image_change_type, |
| 143 syncer::SyncChange::SyncChangeType tracking_change_type); | 143 syncer::SyncChange::SyncChangeType tracking_change_type); |
| 144 | 144 |
| (...skipping 84 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 |