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 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
293 const gfx::Image& image) { | 293 const gfx::Image& image) { |
294 // No matter what happens, we need to mark the favicon as being set. | 294 // No matter what happens, we need to mark the favicon as being set. |
295 entry->GetFavicon().valid = true; | 295 entry->GetFavicon().valid = true; |
296 | 296 |
297 bool icon_url_changed = (entry->GetFavicon().url != icon_url); | 297 bool icon_url_changed = (entry->GetFavicon().url != icon_url); |
298 entry->GetFavicon().url = icon_url; | 298 entry->GetFavicon().url = icon_url; |
299 | 299 |
300 if (image.IsEmpty()) | 300 if (image.IsEmpty()) |
301 return; | 301 return; |
302 | 302 |
303 entry->GetFavicon().image = image; | 303 gfx::Image image_with_adjusted_colorspace = image; |
| 304 FaviconUtil::SetFaviconColorSpace(&image_with_adjusted_colorspace); |
| 305 |
| 306 entry->GetFavicon().image = image_with_adjusted_colorspace; |
304 delegate_->NotifyFaviconUpdated(icon_url_changed); | 307 delegate_->NotifyFaviconUpdated(icon_url_changed); |
305 } | 308 } |
306 | 309 |
307 void FaviconHandler::OnUpdateFaviconURL( | 310 void FaviconHandler::OnUpdateFaviconURL( |
308 int32 page_id, | 311 int32 page_id, |
309 const std::vector<FaviconURL>& candidates) { | 312 const std::vector<FaviconURL>& candidates) { |
310 | 313 |
311 image_urls_.clear(); | 314 image_urls_.clear(); |
312 favicon_candidate_ = FaviconCandidate(); | 315 favicon_candidate_ = FaviconCandidate(); |
313 for (std::vector<FaviconURL>::const_iterator i = candidates.begin(); | 316 for (std::vector<FaviconURL>::const_iterator i = candidates.begin(); |
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
593 const int download_id = DownloadFavicon(image_url, image_size); | 596 const int download_id = DownloadFavicon(image_url, image_size); |
594 if (download_id) { | 597 if (download_id) { |
595 // Download ids should be unique. | 598 // Download ids should be unique. |
596 DCHECK(download_requests_.find(download_id) == download_requests_.end()); | 599 DCHECK(download_requests_.find(download_id) == download_requests_.end()); |
597 download_requests_[download_id] = | 600 download_requests_[download_id] = |
598 DownloadRequest(url, image_url, icon_type); | 601 DownloadRequest(url, image_url, icon_type); |
599 } | 602 } |
600 | 603 |
601 return download_id; | 604 return download_id; |
602 } | 605 } |
OLD | NEW |