| 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/favicon/select_favicon_frames.h" | 10 #include "chrome/browser/favicon/select_favicon_frames.h" |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 116 } | 116 } |
| 117 std::vector<unsigned char> image_data; | 117 std::vector<unsigned char> image_data; |
| 118 // TODO: Save all representations. | 118 // TODO: Save all representations. |
| 119 gfx::PNGCodec::EncodeBGRASkBitmap( | 119 gfx::PNGCodec::EncodeBGRASkBitmap( |
| 120 favicon.image.AsBitmap(), false, &image_data); | 120 favicon.image.AsBitmap(), false, &image_data); |
| 121 service->SetFavicon( | 121 service->SetFavicon( |
| 122 entry->GetURL(), favicon.url, image_data, history::FAVICON); | 122 entry->GetURL(), favicon.url, image_data, history::FAVICON); |
| 123 } | 123 } |
| 124 | 124 |
| 125 int FaviconTabHelper::DownloadImage(const GURL& image_url, | 125 int FaviconTabHelper::DownloadImage(const GURL& image_url, |
| 126 int image_size, | 126 int image_size, |
| 127 history::IconType icon_type, | 127 history::IconType icon_type, |
| 128 const ImageDownloadCallback& callback) { | 128 const ImageDownloadCallback& callback) { |
| 129 if (icon_type == history::FAVICON) | 129 if (icon_type == history::FAVICON) |
| 130 return favicon_handler_->DownloadImage(image_url, image_size, icon_type, | 130 return favicon_handler_->DownloadImage(image_url, image_size, icon_type, |
| 131 callback); | 131 callback); |
| 132 else if (touch_icon_handler_.get()) | 132 else if (touch_icon_handler_.get()) |
| 133 return touch_icon_handler_->DownloadImage(image_url, image_size, icon_type, | 133 return touch_icon_handler_->DownloadImage(image_url, image_size, icon_type, |
| 134 callback); | 134 callback); |
| 135 return 0; | 135 return 0; |
| 136 } | 136 } |
| 137 | 137 |
| 138 void FaviconTabHelper::OnUpdateFaviconURL( | 138 void FaviconTabHelper::OnUpdateFaviconURL( |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 scale_factors = ui::GetSupportedScaleFactors(); | 203 scale_factors = ui::GetSupportedScaleFactors(); |
| 204 gfx::Image favicon(SelectFaviconFrames( | 204 gfx::Image favicon(SelectFaviconFrames( |
| 205 bitmaps, scale_factors, requested_size, &score)); | 205 bitmaps, scale_factors, requested_size, &score)); |
| 206 favicon_handler_->OnDidDownloadFavicon( | 206 favicon_handler_->OnDidDownloadFavicon( |
| 207 id, image_url, errored, favicon, score); | 207 id, image_url, errored, favicon, score); |
| 208 if (touch_icon_handler_.get()) { | 208 if (touch_icon_handler_.get()) { |
| 209 touch_icon_handler_->OnDidDownloadFavicon( | 209 touch_icon_handler_->OnDidDownloadFavicon( |
| 210 id, image_url, errored, favicon, score); | 210 id, image_url, errored, favicon, score); |
| 211 } | 211 } |
| 212 } | 212 } |
| OLD | NEW |