| 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/message_loop/message_loop_proxy.h" | 7 #include "base/message_loop/message_loop_proxy.h" |
| 8 #include "chrome/browser/favicon/favicon_util.h" | 8 #include "chrome/browser/favicon/favicon_util.h" |
| 9 #include "chrome/browser/favicon/imported_favicon_usage.h" |
| 9 #include "chrome/browser/history/history_backend.h" | 10 #include "chrome/browser/history/history_backend.h" |
| 10 #include "chrome/browser/history/history_service.h" | 11 #include "chrome/browser/history/history_service.h" |
| 11 #include "chrome/browser/history/history_service_factory.h" | 12 #include "chrome/browser/history/history_service_factory.h" |
| 12 #include "chrome/browser/history/select_favicon_frames.h" | 13 #include "chrome/browser/history/select_favicon_frames.h" |
| 13 #include "chrome/browser/ui/webui/chrome_web_ui_controller_factory.h" | 14 #include "chrome/browser/ui/webui/chrome_web_ui_controller_factory.h" |
| 14 #include "chrome/common/url_constants.h" | 15 #include "chrome/common/url_constants.h" |
| 15 #include "extensions/common/constants.h" | 16 #include "extensions/common/constants.h" |
| 16 #include "third_party/skia/include/core/SkBitmap.h" | 17 #include "third_party/skia/include/core/SkBitmap.h" |
| 17 #include "ui/gfx/codec/png_codec.h" | 18 #include "ui/gfx/codec/png_codec.h" |
| 18 #include "ui/gfx/favicon_size.h" | 19 #include "ui/gfx/favicon_size.h" |
| (...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 203 history_service_->SetFaviconsOutOfDateForPage(page_url); | 204 history_service_->SetFaviconsOutOfDateForPage(page_url); |
| 204 } | 205 } |
| 205 | 206 |
| 206 void FaviconService::CloneFavicon(const GURL& old_page_url, | 207 void FaviconService::CloneFavicon(const GURL& old_page_url, |
| 207 const GURL& new_page_url) { | 208 const GURL& new_page_url) { |
| 208 if (history_service_) | 209 if (history_service_) |
| 209 history_service_->CloneFavicons(old_page_url, new_page_url); | 210 history_service_->CloneFavicons(old_page_url, new_page_url); |
| 210 } | 211 } |
| 211 | 212 |
| 212 void FaviconService::SetImportedFavicons( | 213 void FaviconService::SetImportedFavicons( |
| 213 const std::vector<history::ImportedFaviconUsage>& favicon_usage) { | 214 const std::vector<ImportedFaviconUsage>& favicon_usage) { |
| 214 if (history_service_) | 215 if (history_service_) |
| 215 history_service_->SetImportedFavicons(favicon_usage); | 216 history_service_->SetImportedFavicons(favicon_usage); |
| 216 } | 217 } |
| 217 | 218 |
| 218 void FaviconService::MergeFavicon( | 219 void FaviconService::MergeFavicon( |
| 219 const GURL& page_url, | 220 const GURL& page_url, |
| 220 const GURL& icon_url, | 221 const GURL& icon_url, |
| 221 history::IconType icon_type, | 222 history::IconType icon_type, |
| 222 scoped_refptr<base::RefCountedMemory> bitmap_data, | 223 scoped_refptr<base::RefCountedMemory> bitmap_data, |
| 223 const gfx::Size& pixel_size) { | 224 const gfx::Size& pixel_size) { |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 346 if (!gfx::PNGCodec::EncodeBGRASkBitmap(resized_image.AsBitmap(), false, | 347 if (!gfx::PNGCodec::EncodeBGRASkBitmap(resized_image.AsBitmap(), false, |
| 347 &resized_bitmap_data)) { | 348 &resized_bitmap_data)) { |
| 348 callback.Run(history::FaviconBitmapResult()); | 349 callback.Run(history::FaviconBitmapResult()); |
| 349 return; | 350 return; |
| 350 } | 351 } |
| 351 | 352 |
| 352 bitmap_result.bitmap_data = base::RefCountedBytes::TakeVector( | 353 bitmap_result.bitmap_data = base::RefCountedBytes::TakeVector( |
| 353 &resized_bitmap_data); | 354 &resized_bitmap_data); |
| 354 callback.Run(bitmap_result); | 355 callback.Run(bitmap_result); |
| 355 } | 356 } |
| OLD | NEW |