| 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 "components/favicon/core/favicon_service_impl.h" | 5 #include "components/favicon/core/favicon_service_impl.h" | 
| 6 | 6 | 
| 7 #include <stddef.h> | 7 #include <stddef.h> | 
| 8 #include <cmath> | 8 #include <cmath> | 
| 9 #include <utility> | 9 #include <utility> | 
| 10 | 10 | 
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 202       base::Unretained(this), callback, desired_size); | 202       base::Unretained(this), callback, desired_size); | 
| 203 | 203 | 
| 204   return history_service_->GetFaviconForID(favicon_id, desired_size, | 204   return history_service_->GetFaviconForID(favicon_id, desired_size, | 
| 205                                            callback_runner, tracker); | 205                                            callback_runner, tracker); | 
| 206 } | 206 } | 
| 207 | 207 | 
| 208 void FaviconServiceImpl::SetFaviconOutOfDateForPage(const GURL& page_url) { | 208 void FaviconServiceImpl::SetFaviconOutOfDateForPage(const GURL& page_url) { | 
| 209   history_service_->SetFaviconsOutOfDateForPage(page_url); | 209   history_service_->SetFaviconsOutOfDateForPage(page_url); | 
| 210 } | 210 } | 
| 211 | 211 | 
|  | 212 void FaviconServiceImpl::TouchOnDemandFavicon(const GURL& icon_url) { | 
|  | 213   history_service_->TouchOnDemandFavicon(icon_url); | 
|  | 214 } | 
|  | 215 | 
| 212 void FaviconServiceImpl::SetImportedFavicons( | 216 void FaviconServiceImpl::SetImportedFavicons( | 
| 213     const favicon_base::FaviconUsageDataList& favicon_usage) { | 217     const favicon_base::FaviconUsageDataList& favicon_usage) { | 
| 214   history_service_->SetImportedFavicons(favicon_usage); | 218   history_service_->SetImportedFavicons(favicon_usage); | 
| 215 } | 219 } | 
| 216 | 220 | 
| 217 void FaviconServiceImpl::MergeFavicon( | 221 void FaviconServiceImpl::MergeFavicon( | 
| 218     const GURL& page_url, | 222     const GURL& page_url, | 
| 219     const GURL& icon_url, | 223     const GURL& icon_url, | 
| 220     favicon_base::IconType icon_type, | 224     favicon_base::IconType icon_type, | 
| 221     scoped_refptr<base::RefCountedMemory> bitmap_data, | 225     scoped_refptr<base::RefCountedMemory> bitmap_data, | 
| 222     const gfx::Size& pixel_size) { | 226     const gfx::Size& pixel_size) { | 
| 223   history_service_->MergeFavicon(page_url, icon_url, icon_type, bitmap_data, | 227   history_service_->MergeFavicon(page_url, icon_url, icon_type, bitmap_data, | 
| 224                                  pixel_size); | 228                                  pixel_size); | 
| 225 } | 229 } | 
| 226 | 230 | 
| 227 void FaviconServiceImpl::SetFavicons(const GURL& page_url, | 231 void FaviconServiceImpl::SetFavicons(const GURL& page_url, | 
| 228                                      const GURL& icon_url, | 232                                      const GURL& icon_url, | 
| 229                                      favicon_base::IconType icon_type, | 233                                      favicon_base::IconType icon_type, | 
| 230                                      const gfx::Image& image) { | 234                                      const gfx::Image& image) { | 
| 231   history_service_->SetFavicons(page_url, icon_type, icon_url, | 235   history_service_->SetFavicons(page_url, icon_type, icon_url, | 
| 232                                 ExtractSkBitmapsToStore(image)); | 236                                 ExtractSkBitmapsToStore(image)); | 
| 233 } | 237 } | 
| 234 | 238 | 
| 235 void FaviconServiceImpl::SetLastResortFavicons( | 239 void FaviconServiceImpl::SetOnDemandFavicons( | 
| 236     const GURL& page_url, | 240     const GURL& page_url, | 
| 237     const GURL& icon_url, | 241     const GURL& icon_url, | 
| 238     favicon_base::IconType icon_type, | 242     favicon_base::IconType icon_type, | 
| 239     const gfx::Image& image, | 243     const gfx::Image& image, | 
| 240     base::Callback<void(bool)> callback) { | 244     base::Callback<void(bool)> callback) { | 
| 241   history_service_->SetLastResortFavicons( | 245   history_service_->SetOnDemandFavicons( | 
| 242       page_url, icon_type, icon_url, ExtractSkBitmapsToStore(image), callback); | 246       page_url, icon_type, icon_url, ExtractSkBitmapsToStore(image), callback); | 
| 243 } | 247 } | 
| 244 | 248 | 
| 245 void FaviconServiceImpl::UnableToDownloadFavicon(const GURL& icon_url) { | 249 void FaviconServiceImpl::UnableToDownloadFavicon(const GURL& icon_url) { | 
| 246   MissingFaviconURLHash url_hash = base::Hash(icon_url.spec()); | 250   MissingFaviconURLHash url_hash = base::Hash(icon_url.spec()); | 
| 247   missing_favicon_urls_.insert(url_hash); | 251   missing_favicon_urls_.insert(url_hash); | 
| 248 } | 252 } | 
| 249 | 253 | 
| 250 bool FaviconServiceImpl::WasUnableToDownloadFavicon( | 254 bool FaviconServiceImpl::WasUnableToDownloadFavicon( | 
| 251     const GURL& icon_url) const { | 255     const GURL& icon_url) const { | 
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
| 297     const std::vector<favicon_base::FaviconRawBitmapResult>& | 301     const std::vector<favicon_base::FaviconRawBitmapResult>& | 
| 298         favicon_bitmap_results) { | 302         favicon_bitmap_results) { | 
| 299   TRACE_EVENT0( | 303   TRACE_EVENT0( | 
| 300       "browser", | 304       "browser", | 
| 301       "FaviconServiceImpl::RunFaviconRawBitmapCallbackWithBitmapResults"); | 305       "FaviconServiceImpl::RunFaviconRawBitmapCallbackWithBitmapResults"); | 
| 302   callback.Run( | 306   callback.Run( | 
| 303       ResizeFaviconBitmapResult(favicon_bitmap_results, desired_size_in_pixel)); | 307       ResizeFaviconBitmapResult(favicon_bitmap_results, desired_size_in_pixel)); | 
| 304 } | 308 } | 
| 305 | 309 | 
| 306 }  // namespace favicon | 310 }  // namespace favicon | 
| OLD | NEW | 
|---|