Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(591)

Side by Side Diff: components/favicon/core/favicon_handler.cc

Issue 1064823002: Componentize FaviconTabHelper (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@favicon-notification
Patch Set: Fix BUILD.gn Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « components/favicon/core/favicon_handler.h ('k') | components/favicon/ios/web_favicon_driver.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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
OLDNEW
« no previous file with comments | « components/favicon/core/favicon_handler.h ('k') | components/favicon/ios/web_favicon_driver.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698