| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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 #include "chrome/browser/sync/glue/favicon_cache.h" | 5 #include "chrome/browser/sync/glue/favicon_cache.h" |
| 6 | 6 |
| 7 #include "base/message_loop/message_loop.h" | 7 #include "base/message_loop/message_loop.h" |
| 8 #include "base/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
| 9 #include "chrome/browser/chrome_notification_types.h" | 9 #include "chrome/browser/chrome_notification_types.h" |
| 10 #include "chrome/browser/favicon/favicon_service.h" | 10 #include "chrome/browser/favicon/favicon_service.h" |
| (...skipping 425 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 436 } | 436 } |
| 437 FaviconService* favicon_service = | 437 FaviconService* favicon_service = |
| 438 FaviconServiceFactory::GetForProfile(profile_, Profile::EXPLICIT_ACCESS); | 438 FaviconServiceFactory::GetForProfile(profile_, Profile::EXPLICIT_ACCESS); |
| 439 if (!favicon_service) | 439 if (!favicon_service) |
| 440 return; | 440 return; |
| 441 // TODO(zea): This appears to only fetch one favicon (best match based on | 441 // TODO(zea): This appears to only fetch one favicon (best match based on |
| 442 // desired_size_in_dip). Figure out a way to fetch all favicons we support. | 442 // desired_size_in_dip). Figure out a way to fetch all favicons we support. |
| 443 // See crbug.com/181068. | 443 // See crbug.com/181068. |
| 444 base::CancelableTaskTracker::TaskId id = | 444 base::CancelableTaskTracker::TaskId id = |
| 445 favicon_service->GetFaviconForPageURL( | 445 favicon_service->GetFaviconForPageURL( |
| 446 FaviconService::FaviconForPageURLParams( | 446 page_url, |
| 447 page_url, SupportedFaviconTypes(), kMaxFaviconResolution), | 447 SupportedFaviconTypes(), |
| 448 kMaxFaviconResolution, |
| 448 base::Bind(&FaviconCache::OnFaviconDataAvailable, | 449 base::Bind(&FaviconCache::OnFaviconDataAvailable, |
| 449 weak_ptr_factory_.GetWeakPtr(), | 450 weak_ptr_factory_.GetWeakPtr(), |
| 450 page_url), | 451 page_url), |
| 451 &cancelable_task_tracker_); | 452 &cancelable_task_tracker_); |
| 452 page_task_map_[page_url] = id; | 453 page_task_map_[page_url] = id; |
| 453 } | 454 } |
| 454 | 455 |
| 455 void FaviconCache::OnFaviconVisited(const GURL& page_url, | 456 void FaviconCache::OnFaviconVisited(const GURL& page_url, |
| 456 const GURL& favicon_url) { | 457 const GURL& favicon_url) { |
| 457 DCHECK(page_url.is_valid()); | 458 DCHECK(page_url.is_valid()); |
| (...skipping 600 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1058 | 1059 |
| 1059 size_t FaviconCache::NumFaviconsForTest() const { | 1060 size_t FaviconCache::NumFaviconsForTest() const { |
| 1060 return synced_favicons_.size(); | 1061 return synced_favicons_.size(); |
| 1061 } | 1062 } |
| 1062 | 1063 |
| 1063 size_t FaviconCache::NumTasksForTest() const { | 1064 size_t FaviconCache::NumTasksForTest() const { |
| 1064 return page_task_map_.size(); | 1065 return page_task_map_.size(); |
| 1065 } | 1066 } |
| 1066 | 1067 |
| 1067 } // namespace browser_sync | 1068 } // namespace browser_sync |
| OLD | NEW |