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 305 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
316 const gfx::Image& image) { | 316 const gfx::Image& image) { |
317 // No matter what happens, we need to mark the favicon as being set. | 317 // No matter what happens, we need to mark the favicon as being set. |
318 entry->GetFavicon().valid = true; | 318 entry->GetFavicon().valid = true; |
319 | 319 |
320 bool icon_url_changed = (entry->GetFavicon().url != icon_url); | 320 bool icon_url_changed = (entry->GetFavicon().url != icon_url); |
321 entry->GetFavicon().url = icon_url; | 321 entry->GetFavicon().url = icon_url; |
322 | 322 |
323 if (image.IsEmpty()) | 323 if (image.IsEmpty()) |
324 return; | 324 return; |
325 | 325 |
326 entry->GetFavicon().image = image; | 326 gfx::Image image_with_adjusted_colorspace = image; |
| 327 FaviconUtil::SetFaviconColorSpace(&image_with_adjusted_colorspace); |
| 328 |
| 329 entry->GetFavicon().image = image_with_adjusted_colorspace; |
327 delegate_->NotifyFaviconUpdated(icon_url_changed); | 330 delegate_->NotifyFaviconUpdated(icon_url_changed); |
328 } | 331 } |
329 | 332 |
330 void FaviconHandler::OnUpdateFaviconURL( | 333 void FaviconHandler::OnUpdateFaviconURL( |
331 int32 page_id, | 334 int32 page_id, |
332 const std::vector<FaviconURL>& candidates) { | 335 const std::vector<FaviconURL>& candidates) { |
333 | 336 |
334 image_urls_.clear(); | 337 image_urls_.clear(); |
335 favicon_candidate_ = FaviconCandidate(); | 338 favicon_candidate_ = FaviconCandidate(); |
336 for (std::vector<FaviconURL>::const_iterator i = candidates.begin(); | 339 for (std::vector<FaviconURL>::const_iterator i = candidates.begin(); |
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
619 const int download_id = DownloadFavicon(image_url, image_size, icon_type); | 622 const int download_id = DownloadFavicon(image_url, image_size, icon_type); |
620 if (download_id) { | 623 if (download_id) { |
621 // Download ids should be unique. | 624 // Download ids should be unique. |
622 DCHECK(download_requests_.find(download_id) == download_requests_.end()); | 625 DCHECK(download_requests_.find(download_id) == download_requests_.end()); |
623 download_requests_[download_id] = | 626 download_requests_[download_id] = |
624 DownloadRequest(url, image_url, icon_type); | 627 DownloadRequest(url, image_url, icon_type); |
625 } | 628 } |
626 | 629 |
627 return download_id; | 630 return download_id; |
628 } | 631 } |
OLD | NEW |