| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/favicon/core/favicon_handler.h" | 5 #include "components/favicon/core/favicon_handler.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <cmath> | 8 #include <cmath> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 443 best_favicon_candidate_.image, | 443 best_favicon_candidate_.image, |
| 444 best_favicon_candidate_.icon_type); | 444 best_favicon_candidate_.icon_type); |
| 445 // Reset candidate. | 445 // Reset candidate. |
| 446 image_urls_.clear(); | 446 image_urls_.clear(); |
| 447 download_requests_.clear(); | 447 download_requests_.clear(); |
| 448 best_favicon_candidate_ = FaviconCandidate(); | 448 best_favicon_candidate_ = FaviconCandidate(); |
| 449 } | 449 } |
| 450 } | 450 } |
| 451 } | 451 } |
| 452 | 452 |
| 453 bool FaviconHandler::HasPendingTasksForTest() { |
| 454 return !download_requests_.empty() || |
| 455 cancelable_task_tracker_.HasTrackedTasks(); |
| 456 } |
| 457 |
| 453 bool FaviconHandler::PageChangedSinceFaviconWasRequested() { | 458 bool FaviconHandler::PageChangedSinceFaviconWasRequested() { |
| 454 if (UrlMatches(driver_->GetActiveURL(), url_) && url_.is_valid()) { | 459 if (UrlMatches(driver_->GetActiveURL(), url_) && url_.is_valid()) { |
| 455 return false; | 460 return false; |
| 456 } | 461 } |
| 457 // If the URL has changed out from under us (as will happen with redirects) | 462 // If the URL has changed out from under us (as will happen with redirects) |
| 458 // return true. | 463 // return true. |
| 459 return true; | 464 return true; |
| 460 } | 465 } |
| 461 | 466 |
| 462 int FaviconHandler::DownloadFavicon(const GURL& image_url, | 467 int FaviconHandler::DownloadFavicon(const GURL& image_url, |
| (...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 694 gfx::Size largest = | 699 gfx::Size largest = |
| 695 image_url.icon_sizes[GetLargestSizeIndex(image_url.icon_sizes)]; | 700 image_url.icon_sizes[GetLargestSizeIndex(image_url.icon_sizes)]; |
| 696 image_url.icon_sizes.clear(); | 701 image_url.icon_sizes.clear(); |
| 697 image_url.icon_sizes.push_back(largest); | 702 image_url.icon_sizes.push_back(largest); |
| 698 } | 703 } |
| 699 std::stable_sort(image_urls_.begin(), image_urls_.end(), | 704 std::stable_sort(image_urls_.begin(), image_urls_.end(), |
| 700 CompareIconSize); | 705 CompareIconSize); |
| 701 } | 706 } |
| 702 | 707 |
| 703 } // namespace favicon | 708 } // namespace favicon |
| OLD | NEW |