| 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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 tracker->NewTrackedTaskId(&is_canceled_cb); | 57 tracker->NewTrackedTaskId(&is_canceled_cb); |
| 58 favicon_base::FaviconResultsCallback cancelable_cb = | 58 favicon_base::FaviconResultsCallback cancelable_cb = |
| 59 Bind(&CancelOrRunFaviconResultsCallback, is_canceled_cb, callback); | 59 Bind(&CancelOrRunFaviconResultsCallback, is_canceled_cb, callback); |
| 60 ChromeWebUIControllerFactory::GetInstance()->GetFaviconForURL(profile, | 60 ChromeWebUIControllerFactory::GetInstance()->GetFaviconForURL(profile, |
| 61 page_url, desired_scale_factors, cancelable_cb); | 61 page_url, desired_scale_factors, cancelable_cb); |
| 62 return id; | 62 return id; |
| 63 } | 63 } |
| 64 | 64 |
| 65 } // namespace | 65 } // namespace |
| 66 | 66 |
| 67 FaviconService::FaviconService(Profile* profile) | 67 FaviconService::FaviconService(Profile* profile, FaviconClient* favicon_client) |
| 68 : history_service_(HistoryServiceFactory::GetForProfile( | 68 : history_service_( |
| 69 profile, Profile::EXPLICIT_ACCESS)), | 69 HistoryServiceFactory::GetForProfile(profile, |
| 70 profile_(profile) { | 70 Profile::EXPLICIT_ACCESS)), |
| 71 profile_(profile), |
| 72 favicon_client_(favicon_client) { |
| 71 } | 73 } |
| 72 | 74 |
| 73 // static | 75 // static |
| 74 void FaviconService::FaviconResultsCallbackRunner( | 76 void FaviconService::FaviconResultsCallbackRunner( |
| 75 const favicon_base::FaviconResultsCallback& callback, | 77 const favicon_base::FaviconResultsCallback& callback, |
| 76 const std::vector<favicon_base::FaviconBitmapResult>* results) { | 78 const std::vector<favicon_base::FaviconBitmapResult>* results) { |
| 77 callback.Run(*results); | 79 callback.Run(*results); |
| 78 } | 80 } |
| 79 | 81 |
| 80 base::CancelableTaskTracker::TaskId FaviconService::GetFaviconImage( | 82 base::CancelableTaskTracker::TaskId FaviconService::GetFaviconImage( |
| (...skipping 320 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 401 if (!gfx::PNGCodec::EncodeBGRASkBitmap(resized_image.AsBitmap(), false, | 403 if (!gfx::PNGCodec::EncodeBGRASkBitmap(resized_image.AsBitmap(), false, |
| 402 &resized_bitmap_data)) { | 404 &resized_bitmap_data)) { |
| 403 callback.Run(favicon_base::FaviconBitmapResult()); | 405 callback.Run(favicon_base::FaviconBitmapResult()); |
| 404 return; | 406 return; |
| 405 } | 407 } |
| 406 | 408 |
| 407 bitmap_result.bitmap_data = base::RefCountedBytes::TakeVector( | 409 bitmap_result.bitmap_data = base::RefCountedBytes::TakeVector( |
| 408 &resized_bitmap_data); | 410 &resized_bitmap_data); |
| 409 callback.Run(bitmap_result); | 411 callback.Run(bitmap_result); |
| 410 } | 412 } |
| OLD | NEW |