| 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_service.h" | 5 #include "chrome/browser/favicon/favicon_service.h" |
| 6 | 6 |
| 7 #include "base/hash.h" | 7 #include "base/hash.h" |
| 8 #include "base/message_loop/message_loop_proxy.h" | 8 #include "base/message_loop/message_loop_proxy.h" |
| 9 #include "chrome/browser/favicon/favicon_util.h" | 9 #include "chrome/browser/favicon/favicon_util.h" |
| 10 #include "chrome/browser/history/history_backend.h" | 10 #include "chrome/browser/history/history_backend.h" |
| (...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 288 CancelableTaskTracker::TaskId id = | 288 CancelableTaskTracker::TaskId id = |
| 289 tracker->NewTrackedTaskId(&is_canceled_cb); | 289 tracker->NewTrackedTaskId(&is_canceled_cb); |
| 290 | 290 |
| 291 FaviconResultsCallback cancelable_cb = | 291 FaviconResultsCallback cancelable_cb = |
| 292 Bind(&CancelOrRunFaviconResultsCallback, is_canceled_cb, callback); | 292 Bind(&CancelOrRunFaviconResultsCallback, is_canceled_cb, callback); |
| 293 ChromeWebUIControllerFactory::GetInstance()->GetFaviconForURL( | 293 ChromeWebUIControllerFactory::GetInstance()->GetFaviconForURL( |
| 294 params.profile, params.page_url, desired_scale_factors, cancelable_cb); | 294 params.profile, params.page_url, desired_scale_factors, cancelable_cb); |
| 295 return id; | 295 return id; |
| 296 } else if (history_service_) { | 296 } else if (history_service_) { |
| 297 return history_service_->GetFaviconsForURL(params.page_url, | 297 return history_service_->GetFaviconsForURL(params.page_url, |
| 298 params.icon_types, | 298 params.icon_types_priority, params.desired_size_in_dip, |
| 299 params.desired_size_in_dip, | 299 desired_scale_factors, params.threshold_for_next_icon_types, callback, |
| 300 desired_scale_factors, | 300 tracker); |
| 301 callback, | |
| 302 tracker); | |
| 303 } else { | 301 } else { |
| 304 return RunWithEmptyResultAsync(callback, tracker); | 302 return RunWithEmptyResultAsync(callback, tracker); |
| 305 } | 303 } |
| 306 } | 304 } |
| 307 | 305 |
| 308 void FaviconService::RunFaviconImageCallbackWithBitmapResults( | 306 void FaviconService::RunFaviconImageCallbackWithBitmapResults( |
| 309 const FaviconImageCallback& callback, | 307 const FaviconImageCallback& callback, |
| 310 int desired_size_in_dip, | 308 int desired_size_in_dip, |
| 311 const std::vector<chrome::FaviconBitmapResult>& favicon_bitmap_results) { | 309 const std::vector<chrome::FaviconBitmapResult>& favicon_bitmap_results) { |
| 312 chrome::FaviconImageResult image_result; | 310 chrome::FaviconImageResult image_result; |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 364 if (!gfx::PNGCodec::EncodeBGRASkBitmap(resized_image.AsBitmap(), false, | 362 if (!gfx::PNGCodec::EncodeBGRASkBitmap(resized_image.AsBitmap(), false, |
| 365 &resized_bitmap_data)) { | 363 &resized_bitmap_data)) { |
| 366 callback.Run(chrome::FaviconBitmapResult()); | 364 callback.Run(chrome::FaviconBitmapResult()); |
| 367 return; | 365 return; |
| 368 } | 366 } |
| 369 | 367 |
| 370 bitmap_result.bitmap_data = base::RefCountedBytes::TakeVector( | 368 bitmap_result.bitmap_data = base::RefCountedBytes::TakeVector( |
| 371 &resized_bitmap_data); | 369 &resized_bitmap_data); |
| 372 callback.Run(bitmap_result); | 370 callback.Run(bitmap_result); |
| 373 } | 371 } |
| OLD | NEW |