| 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 <cmath> | 7 #include <cmath> |
| 8 | 8 |
| 9 #include "base/hash.h" | 9 #include "base/hash.h" |
| 10 #include "base/message_loop/message_loop_proxy.h" | 10 #include "base/message_loop/message_loop_proxy.h" |
| 11 #include "chrome/browser/history/history_backend.h" | 11 #include "chrome/browser/history/history_backend.h" |
| 12 #include "chrome/browser/history/history_service.h" | 12 #include "chrome/browser/history/history_service.h" |
| 13 #include "chrome/browser/history/history_service_factory.h" | 13 #include "chrome/browser/history/history_service_factory.h" |
| 14 #include "chrome/browser/ui/webui/chrome_web_ui_controller_factory.h" | 14 #include "chrome/browser/ui/webui/chrome_web_ui_controller_factory.h" |
| 15 #include "chrome/common/importer/imported_favicon_usage.h" | 15 #include "chrome/common/importer/imported_favicon_usage.h" |
| 16 #include "chrome/common/url_constants.h" | 16 #include "chrome/common/url_constants.h" |
| 17 #include "components/favicon_base/favicon_types.h" | |
| 18 #include "components/favicon_base/favicon_util.h" | 17 #include "components/favicon_base/favicon_util.h" |
| 19 #include "components/favicon_base/select_favicon_frames.h" | 18 #include "components/favicon_base/select_favicon_frames.h" |
| 20 #include "extensions/common/constants.h" | 19 #include "extensions/common/constants.h" |
| 21 #include "third_party/skia/include/core/SkBitmap.h" | 20 #include "third_party/skia/include/core/SkBitmap.h" |
| 22 #include "ui/gfx/codec/png_codec.h" | 21 #include "ui/gfx/codec/png_codec.h" |
| 23 #include "ui/gfx/favicon_size.h" | 22 #include "ui/gfx/favicon_size.h" |
| 24 #include "ui/gfx/image/image_skia.h" | 23 #include "ui/gfx/image/image_skia.h" |
| 24 #include "url/gurl.h" |
| 25 | 25 |
| 26 using base::Bind; | 26 using base::Bind; |
| 27 | 27 |
| 28 namespace { | 28 namespace { |
| 29 | 29 |
| 30 void CancelOrRunFaviconResultsCallback( | 30 void CancelOrRunFaviconResultsCallback( |
| 31 const base::CancelableTaskTracker::IsCanceledCallback& is_canceled, | 31 const base::CancelableTaskTracker::IsCanceledCallback& is_canceled, |
| 32 const favicon_base::FaviconResultsCallback& callback, | 32 const favicon_base::FaviconResultsCallback& callback, |
| 33 const std::vector<favicon_base::FaviconRawBitmapResult>& results) { | 33 const std::vector<favicon_base::FaviconRawBitmapResult>& results) { |
| 34 if (is_canceled.Run()) | 34 if (is_canceled.Run()) |
| (...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 418 if (!gfx::PNGCodec::EncodeBGRASkBitmap(resized_image.AsBitmap(), false, | 418 if (!gfx::PNGCodec::EncodeBGRASkBitmap(resized_image.AsBitmap(), false, |
| 419 &resized_bitmap_data)) { | 419 &resized_bitmap_data)) { |
| 420 callback.Run(favicon_base::FaviconRawBitmapResult()); | 420 callback.Run(favicon_base::FaviconRawBitmapResult()); |
| 421 return; | 421 return; |
| 422 } | 422 } |
| 423 | 423 |
| 424 bitmap_result.bitmap_data = base::RefCountedBytes::TakeVector( | 424 bitmap_result.bitmap_data = base::RefCountedBytes::TakeVector( |
| 425 &resized_bitmap_data); | 425 &resized_bitmap_data); |
| 426 callback.Run(bitmap_result); | 426 callback.Run(bitmap_result); |
| 427 } | 427 } |
| OLD | NEW |