| 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 550 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 561 void FaviconHandler::OnFaviconDataForInitialURLFromFaviconService( | 561 void FaviconHandler::OnFaviconDataForInitialURLFromFaviconService( |
| 562 const std::vector<favicon_base::FaviconRawBitmapResult>& | 562 const std::vector<favicon_base::FaviconRawBitmapResult>& |
| 563 favicon_bitmap_results) { | 563 favicon_bitmap_results) { |
| 564 got_favicon_from_history_ = true; | 564 got_favicon_from_history_ = true; |
| 565 history_results_ = favicon_bitmap_results; | 565 history_results_ = favicon_bitmap_results; |
| 566 bool has_results = !favicon_bitmap_results.empty(); | 566 bool has_results = !favicon_bitmap_results.empty(); |
| 567 favicon_expired_or_incomplete_ = HasExpiredOrIncompleteResult( | 567 favicon_expired_or_incomplete_ = HasExpiredOrIncompleteResult( |
| 568 preferred_icon_size(), favicon_bitmap_results); | 568 preferred_icon_size(), favicon_bitmap_results); |
| 569 bool has_valid_result = HasValidResult(favicon_bitmap_results); | 569 bool has_valid_result = HasValidResult(favicon_bitmap_results); |
| 570 | 570 |
| 571 if (has_results && handler_type_ == FAVICON && | 571 if (has_results && handler_type_ == FAVICON && !download_largest_icon_ && |
| 572 !download_largest_icon_ && !driver_->GetActiveFaviconValidity() && | |
| 573 (!current_candidate() || | 572 (!current_candidate() || |
| 574 DoUrlsAndIconsMatch(*current_candidate(), favicon_bitmap_results))) { | 573 DoUrlsAndIconsMatch(*current_candidate(), favicon_bitmap_results))) { |
| 575 if (has_valid_result) { | 574 if (has_valid_result) { |
| 576 // The db knows the favicon (although it may be out of date) and the entry | 575 // The db knows the favicon (although it may be out of date) and the entry |
| 577 // doesn't have an icon. Set the favicon now, and if the favicon turns out | 576 // doesn't have an icon. Set the favicon now, and if the favicon turns out |
| 578 // to be expired (or the wrong url) we'll fetch later on. This way the | 577 // to be expired (or the wrong url) we'll fetch later on. This way the |
| 579 // user doesn't see a flash of the default favicon. | 578 // user doesn't see a flash of the default favicon. |
| 580 NotifyFaviconAvailable(favicon_bitmap_results); | 579 NotifyFaviconAvailable(favicon_bitmap_results); |
| 581 } else { | 580 } else { |
| 582 // If |favicon_bitmap_results| does not have any valid results, treat the | 581 // If |favicon_bitmap_results| does not have any valid results, treat the |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 682 // If DownloadFavicon() did not start a download, it returns a download id | 681 // If DownloadFavicon() did not start a download, it returns a download id |
| 683 // of 0. We still need to call OnDidDownloadFavicon() because the method is | 682 // of 0. We still need to call OnDidDownloadFavicon() because the method is |
| 684 // responsible for initiating the data request for the next candidate. | 683 // responsible for initiating the data request for the next candidate. |
| 685 OnDidDownloadFavicon(download_id, image_url, std::vector<SkBitmap>(), | 684 OnDidDownloadFavicon(download_id, image_url, std::vector<SkBitmap>(), |
| 686 std::vector<gfx::Size>()); | 685 std::vector<gfx::Size>()); |
| 687 | 686 |
| 688 } | 687 } |
| 689 } | 688 } |
| 690 | 689 |
| 691 } // namespace favicon | 690 } // namespace favicon |
| OLD | NEW |