| 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 "components/sync_sessions/favicon_cache.h" | 5 #include "components/sync_sessions/favicon_cache.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/location.h" | 9 #include "base/location.h" |
| 10 #include "base/metrics/histogram_macros.h" | 10 #include "base/metrics/histogram_macros.h" |
| (...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 426 } | 426 } |
| 427 } | 427 } |
| 428 | 428 |
| 429 DVLOG(1) << "Triggering favicon load for url " << page_url.spec(); | 429 DVLOG(1) << "Triggering favicon load for url " << page_url.spec(); |
| 430 | 430 |
| 431 if (!favicon_service_) { | 431 if (!favicon_service_) { |
| 432 page_task_map_[page_url] = 0; // For testing only. | 432 page_task_map_[page_url] = 0; // For testing only. |
| 433 return; | 433 return; |
| 434 } | 434 } |
| 435 | 435 |
| 436 // TODO(zea): This appears to only fetch one favicon (best match based on | |
| 437 // desired_size_in_dip). Figure out a way to fetch all favicons we support. | |
| 438 // See crbug.com/181068. | |
| 439 base::CancelableTaskTracker::TaskId id = | 436 base::CancelableTaskTracker::TaskId id = |
| 440 favicon_service_->GetFaviconForPageURL( | 437 favicon_service_->GetFaviconForPageURL( |
| 441 page_url, SupportedFaviconTypes(), kMaxFaviconResolution, | 438 page_url, SupportedFaviconTypes(), {kMaxFaviconResolution}, |
| 442 base::Bind(&FaviconCache::OnFaviconDataAvailable, | 439 base::Bind(&FaviconCache::OnFaviconDataAvailable, |
| 443 weak_ptr_factory_.GetWeakPtr(), page_url), | 440 weak_ptr_factory_.GetWeakPtr(), page_url), |
| 444 &cancelable_task_tracker_); | 441 &cancelable_task_tracker_); |
| 445 page_task_map_[page_url] = id; | 442 page_task_map_[page_url] = id; |
| 446 } | 443 } |
| 447 | 444 |
| 448 void FaviconCache::OnFaviconVisited(const GURL& page_url, | 445 void FaviconCache::OnFaviconVisited(const GURL& page_url, |
| 449 const GURL& favicon_url) { | 446 const GURL& favicon_url) { |
| 450 DCHECK(page_url.is_valid()); | 447 DCHECK(page_url.is_valid()); |
| 451 if (!favicon_url.is_valid() || | 448 if (!favicon_url.is_valid() || |
| (...skipping 587 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1039 favicon_images_sync_processor_->ProcessSyncChanges(FROM_HERE, | 1036 favicon_images_sync_processor_->ProcessSyncChanges(FROM_HERE, |
| 1040 image_deletions); | 1037 image_deletions); |
| 1041 } | 1038 } |
| 1042 if (favicon_tracking_sync_processor_.get()) { | 1039 if (favicon_tracking_sync_processor_.get()) { |
| 1043 favicon_tracking_sync_processor_->ProcessSyncChanges(FROM_HERE, | 1040 favicon_tracking_sync_processor_->ProcessSyncChanges(FROM_HERE, |
| 1044 tracking_deletions); | 1041 tracking_deletions); |
| 1045 } | 1042 } |
| 1046 } | 1043 } |
| 1047 | 1044 |
| 1048 } // namespace sync_sessions | 1045 } // namespace sync_sessions |
| OLD | NEW |