| 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_tab_helper.h" | 5 #include "chrome/browser/favicon/favicon_tab_helper.h" |
| 6 | 6 |
| 7 #include "chrome/browser/favicon/favicon_handler.h" | 7 #include "chrome/browser/favicon/favicon_handler.h" |
| 8 #include "chrome/browser/favicon/favicon_service_factory.h" | 8 #include "chrome/browser/favicon/favicon_service_factory.h" |
| 9 #include "chrome/browser/favicon/favicon_util.h" | 9 #include "chrome/browser/favicon/favicon_util.h" |
| 10 #include "chrome/browser/history/history.h" | 10 #include "chrome/browser/history/history.h" |
| 11 #include "chrome/browser/history/history_service_factory.h" | 11 #include "chrome/browser/history/history_service_factory.h" |
| 12 #include "chrome/browser/history/select_favicon_frames.h" | |
| 13 #include "chrome/browser/profiles/profile.h" | 12 #include "chrome/browser/profiles/profile.h" |
| 14 #include "chrome/common/chrome_constants.h" | 13 #include "chrome/common/chrome_constants.h" |
| 15 #include "chrome/common/chrome_notification_types.h" | 14 #include "chrome/common/chrome_notification_types.h" |
| 16 #include "chrome/common/icon_messages.h" | 15 #include "chrome/common/icon_messages.h" |
| 17 #include "content/public/browser/favicon_status.h" | 16 #include "content/public/browser/favicon_status.h" |
| 18 #include "content/public/browser/invalidate_type.h" | 17 #include "content/public/browser/invalidate_type.h" |
| 19 #include "content/public/browser/navigation_controller.h" | 18 #include "content/public/browser/navigation_controller.h" |
| 20 #include "content/public/browser/navigation_details.h" | 19 #include "content/public/browser/navigation_details.h" |
| 21 #include "content/public/browser/navigation_entry.h" | 20 #include "content/public/browser/navigation_entry.h" |
| 22 #include "content/public/browser/notification_service.h" | 21 #include "content/public/browser/notification_service.h" |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 189 IPC_END_MESSAGE_MAP() | 188 IPC_END_MESSAGE_MAP() |
| 190 return message_handled; | 189 return message_handled; |
| 191 } | 190 } |
| 192 | 191 |
| 193 void FaviconTabHelper::OnDidDownloadFavicon( | 192 void FaviconTabHelper::OnDidDownloadFavicon( |
| 194 int id, | 193 int id, |
| 195 const GURL& image_url, | 194 const GURL& image_url, |
| 196 bool errored, | 195 bool errored, |
| 197 int requested_size, | 196 int requested_size, |
| 198 const std::vector<SkBitmap>& bitmaps) { | 197 const std::vector<SkBitmap>& bitmaps) { |
| 199 float score = 0; | |
| 200 // TODO: Possibly do bitmap selection in FaviconHandler, so that it can score | |
| 201 // favicons better. | |
| 202 std::vector<ui::ScaleFactor> scale_factors; | |
| 203 scale_factors = ui::GetSupportedScaleFactors(); | |
| 204 gfx::Image favicon(SelectFaviconFrames( | |
| 205 bitmaps, scale_factors, requested_size, &score)); | |
| 206 favicon_handler_->OnDidDownloadFavicon( | 198 favicon_handler_->OnDidDownloadFavicon( |
| 207 id, image_url, errored, favicon, score); | 199 id, image_url, errored, requested_size, bitmaps); |
| 208 if (touch_icon_handler_.get()) { | 200 if (touch_icon_handler_.get()) { |
| 209 touch_icon_handler_->OnDidDownloadFavicon( | 201 touch_icon_handler_->OnDidDownloadFavicon( |
| 210 id, image_url, errored, favicon, score); | 202 id, image_url, errored, requested_size, bitmaps); |
| 211 } | 203 } |
| 212 } | 204 } |
| OLD | NEW |