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_handler.h" | 5 #include "chrome/browser/favicon/favicon_handler.h" |
6 | 6 |
7 #include "build/build_config.h" | 7 #include "build/build_config.h" |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <vector> | 10 #include <vector> |
(...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
442 return 0; | 442 return 0; |
443 } | 443 } |
444 return delegate_->StartDownload(image_url, max_bitmap_size); | 444 return delegate_->StartDownload(image_url, max_bitmap_size); |
445 } | 445 } |
446 | 446 |
447 void FaviconHandler::UpdateFaviconMappingAndFetch( | 447 void FaviconHandler::UpdateFaviconMappingAndFetch( |
448 const GURL& page_url, | 448 const GURL& page_url, |
449 const GURL& icon_url, | 449 const GURL& icon_url, |
450 chrome::IconType icon_type, | 450 chrome::IconType icon_type, |
451 const FaviconService::FaviconResultsCallback& callback, | 451 const FaviconService::FaviconResultsCallback& callback, |
452 CancelableTaskTracker* tracker) { | 452 base::CancelableTaskTracker* tracker) { |
453 // TODO(pkotwicz): pass in all of |image_urls_| to | 453 // TODO(pkotwicz): pass in all of |image_urls_| to |
454 // UpdateFaviconMappingsAndFetch(). | 454 // UpdateFaviconMappingsAndFetch(). |
455 std::vector<GURL> icon_urls; | 455 std::vector<GURL> icon_urls; |
456 icon_urls.push_back(icon_url); | 456 icon_urls.push_back(icon_url); |
457 GetFaviconService()->UpdateFaviconMappingsAndFetch( | 457 GetFaviconService()->UpdateFaviconMappingsAndFetch( |
458 page_url, icon_urls, icon_type, preferred_icon_size(), callback, tracker); | 458 page_url, icon_urls, icon_type, preferred_icon_size(), callback, tracker); |
459 } | 459 } |
460 | 460 |
461 void FaviconHandler::GetFavicon( | 461 void FaviconHandler::GetFavicon( |
462 const GURL& icon_url, | 462 const GURL& icon_url, |
463 chrome::IconType icon_type, | 463 chrome::IconType icon_type, |
464 const FaviconService::FaviconResultsCallback& callback, | 464 const FaviconService::FaviconResultsCallback& callback, |
465 CancelableTaskTracker* tracker) { | 465 base::CancelableTaskTracker* tracker) { |
466 GetFaviconService()->GetFavicon( | 466 GetFaviconService()->GetFavicon( |
467 icon_url, icon_type, preferred_icon_size(), callback, tracker); | 467 icon_url, icon_type, preferred_icon_size(), callback, tracker); |
468 } | 468 } |
469 | 469 |
470 void FaviconHandler::GetFaviconForURL( | 470 void FaviconHandler::GetFaviconForURL( |
471 const GURL& page_url, | 471 const GURL& page_url, |
472 int icon_types, | 472 int icon_types, |
473 const FaviconService::FaviconResultsCallback& callback, | 473 const FaviconService::FaviconResultsCallback& callback, |
474 CancelableTaskTracker* tracker) { | 474 base::CancelableTaskTracker* tracker) { |
475 GetFaviconService()->GetFaviconForURL( | 475 GetFaviconService()->GetFaviconForURL( |
476 FaviconService::FaviconForURLParams(page_url, icon_types, | 476 FaviconService::FaviconForURLParams(page_url, icon_types, |
477 preferred_icon_size()), | 477 preferred_icon_size()), |
478 callback, | 478 callback, |
479 tracker); | 479 tracker); |
480 } | 480 } |
481 | 481 |
482 void FaviconHandler::SetHistoryFavicons(const GURL& page_url, | 482 void FaviconHandler::SetHistoryFavicons(const GURL& page_url, |
483 const GURL& icon_url, | 483 const GURL& icon_url, |
484 chrome::IconType icon_type, | 484 chrome::IconType icon_type, |
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
627 GetMaximalIconSize(icon_type)); | 627 GetMaximalIconSize(icon_type)); |
628 if (download_id) { | 628 if (download_id) { |
629 // Download ids should be unique. | 629 // Download ids should be unique. |
630 DCHECK(download_requests_.find(download_id) == download_requests_.end()); | 630 DCHECK(download_requests_.find(download_id) == download_requests_.end()); |
631 download_requests_[download_id] = | 631 download_requests_[download_id] = |
632 DownloadRequest(url, image_url, icon_type); | 632 DownloadRequest(url, image_url, icon_type); |
633 } | 633 } |
634 | 634 |
635 return download_id; | 635 return download_id; |
636 } | 636 } |
OLD | NEW |