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 "chrome/browser/favicon/favicon_handler.h" | 5 #include "chrome/browser/favicon/favicon_handler.h" |
6 | 6 |
7 #include "build/build_config.h" | 7 #include "build/build_config.h" |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <vector> | 10 #include <vector> |
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
363 return; | 363 return; |
364 | 364 |
365 gfx::Image image_with_adjusted_colorspace = image; | 365 gfx::Image image_with_adjusted_colorspace = image; |
366 FaviconUtil::SetFaviconColorSpace(&image_with_adjusted_colorspace); | 366 FaviconUtil::SetFaviconColorSpace(&image_with_adjusted_colorspace); |
367 | 367 |
368 entry->GetFavicon().image = image_with_adjusted_colorspace; | 368 entry->GetFavicon().image = image_with_adjusted_colorspace; |
369 NotifyFaviconUpdated(icon_url_changed); | 369 NotifyFaviconUpdated(icon_url_changed); |
370 } | 370 } |
371 | 371 |
372 void FaviconHandler::OnUpdateFaviconURL( | 372 void FaviconHandler::OnUpdateFaviconURL( |
373 int32 page_id, | |
374 const std::vector<FaviconURL>& candidates) { | 373 const std::vector<FaviconURL>& candidates) { |
375 image_urls_.clear(); | 374 image_urls_.clear(); |
376 best_favicon_candidate_ = FaviconCandidate(); | 375 best_favicon_candidate_ = FaviconCandidate(); |
377 for (std::vector<FaviconURL>::const_iterator i = candidates.begin(); | 376 for (std::vector<FaviconURL>::const_iterator i = candidates.begin(); |
378 i != candidates.end(); ++i) { | 377 i != candidates.end(); ++i) { |
379 if (!i->icon_url.is_empty() && (i->icon_type & icon_types_)) | 378 if (!i->icon_url.is_empty() && (i->icon_type & icon_types_)) |
380 image_urls_.push_back(*i); | 379 image_urls_.push_back(*i); |
381 } | 380 } |
382 | 381 |
383 // TODO(davemoore) Should clear on empty url. Currently we ignore it. | 382 // TODO(davemoore) Should clear on empty url. Currently we ignore it. |
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
717 } else { | 716 } else { |
718 gfx::Size largest = i->icon_sizes[index]; | 717 gfx::Size largest = i->icon_sizes[index]; |
719 i->icon_sizes.clear(); | 718 i->icon_sizes.clear(); |
720 i->icon_sizes.push_back(largest); | 719 i->icon_sizes.push_back(largest); |
721 ++i; | 720 ++i; |
722 } | 721 } |
723 } | 722 } |
724 std::stable_sort(image_urls_.begin(), image_urls_.end(), | 723 std::stable_sort(image_urls_.begin(), image_urls_.end(), |
725 CompareIconSize); | 724 CompareIconSize); |
726 } | 725 } |
OLD | NEW |