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 366 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
377 | 377 |
378 // TODO(davemoore) Should clear on empty url. Currently we ignore it. | 378 // TODO(davemoore) Should clear on empty url. Currently we ignore it. |
379 // This appears to be what FF does as well. | 379 // This appears to be what FF does as well. |
380 if (current_candidate()) | 380 if (current_candidate()) |
381 ProcessCurrentUrl(); | 381 ProcessCurrentUrl(); |
382 } | 382 } |
383 | 383 |
384 void FaviconHandler::ProcessCurrentUrl() { | 384 void FaviconHandler::ProcessCurrentUrl() { |
385 DCHECK(!image_urls_.empty()); | 385 DCHECK(!image_urls_.empty()); |
386 | 386 |
387 if (current_candidate()->icon_type == favicon_base::FAVICON && | 387 if (!favicon_expired_or_incomplete_ && got_favicon_from_history_ && |
388 !download_largest_icon_) { | 388 HasValidResult(history_results_) && |
389 if (!favicon_expired_or_incomplete_ && | 389 DoUrlsAndIconsMatch(*current_candidate(), history_results_)) { |
390 driver_->GetActiveFaviconValidity() && | |
391 DoUrlAndIconMatch(*current_candidate(), | |
392 driver_->GetActiveFaviconURL(), | |
393 favicon_base::FAVICON)) | |
394 return; | |
395 } else if (!favicon_expired_or_incomplete_ && got_favicon_from_history_ && | |
396 HasValidResult(history_results_) && | |
397 DoUrlsAndIconsMatch(*current_candidate(), history_results_)) { | |
398 return; | 390 return; |
399 } | 391 } |
400 | 392 |
401 if (got_favicon_from_history_) | 393 if (got_favicon_from_history_) |
402 DownloadFaviconOrAskFaviconService(current_candidate()->icon_url, | 394 DownloadFaviconOrAskFaviconService(current_candidate()->icon_url, |
403 current_candidate()->icon_type); | 395 current_candidate()->icon_type); |
404 } | 396 } |
405 | 397 |
406 void FaviconHandler::OnDidDownloadFavicon( | 398 void FaviconHandler::OnDidDownloadFavicon( |
407 int id, | 399 int id, |
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
690 // If DownloadFavicon() did not start a download, it returns a download id | 682 // If DownloadFavicon() did not start a download, it returns a download id |
691 // of 0. We still need to call OnDidDownloadFavicon() because the method is | 683 // of 0. We still need to call OnDidDownloadFavicon() because the method is |
692 // responsible for initiating the data request for the next candidate. | 684 // responsible for initiating the data request for the next candidate. |
693 OnDidDownloadFavicon(download_id, image_url, std::vector<SkBitmap>(), | 685 OnDidDownloadFavicon(download_id, image_url, std::vector<SkBitmap>(), |
694 std::vector<gfx::Size>()); | 686 std::vector<gfx::Size>()); |
695 | 687 |
696 } | 688 } |
697 } | 689 } |
698 | 690 |
699 } // namespace favicon | 691 } // namespace favicon |
OLD | NEW |