Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(817)

Side by Side Diff: chrome/browser/favicon/favicon_handler.cc

Issue 291643002: Move favicon callbacks to favicon_base (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix Android unittest Created 6 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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>
11 11
12 #include "base/bind.h" 12 #include "base/bind.h"
13 #include "base/bind_helpers.h" 13 #include "base/bind_helpers.h"
14 #include "base/memory/ref_counted_memory.h" 14 #include "base/memory/ref_counted_memory.h"
15 #include "chrome/browser/favicon/favicon_service.h"
15 #include "chrome/browser/favicon/favicon_service_factory.h" 16 #include "chrome/browser/favicon/favicon_service_factory.h"
16 #include "chrome/browser/favicon/favicon_util.h" 17 #include "chrome/browser/favicon/favicon_util.h"
17 #include "components/favicon_base/select_favicon_frames.h" 18 #include "components/favicon_base/select_favicon_frames.h"
18 #include "skia/ext/image_operations.h" 19 #include "skia/ext/image_operations.h"
19 #include "ui/gfx/codec/png_codec.h" 20 #include "ui/gfx/codec/png_codec.h"
20 #include "ui/gfx/image/image.h" 21 #include "ui/gfx/image/image.h"
21 #include "ui/gfx/image/image_skia.h" 22 #include "ui/gfx/image/image_skia.h"
22 #include "ui/gfx/image/image_util.h" 23 #include "ui/gfx/image/image_util.h"
23 24
24 using content::FaviconURL; 25 using content::FaviconURL;
(...skipping 476 matching lines...) Expand 10 before | Expand all | Expand 10 after
501 NOTREACHED(); 502 NOTREACHED();
502 return 0; 503 return 0;
503 } 504 }
504 return driver_->StartDownload(image_url, max_bitmap_size); 505 return driver_->StartDownload(image_url, max_bitmap_size);
505 } 506 }
506 507
507 void FaviconHandler::UpdateFaviconMappingAndFetch( 508 void FaviconHandler::UpdateFaviconMappingAndFetch(
508 const GURL& page_url, 509 const GURL& page_url,
509 const GURL& icon_url, 510 const GURL& icon_url,
510 favicon_base::IconType icon_type, 511 favicon_base::IconType icon_type,
511 const FaviconService::FaviconResultsCallback& callback, 512 const favicon_base::FaviconResultsCallback& callback,
512 base::CancelableTaskTracker* tracker) { 513 base::CancelableTaskTracker* tracker) {
513 // TODO(pkotwicz): pass in all of |image_urls_| to 514 // TODO(pkotwicz): pass in all of |image_urls_| to
514 // UpdateFaviconMappingsAndFetch(). 515 // UpdateFaviconMappingsAndFetch().
515 std::vector<GURL> icon_urls; 516 std::vector<GURL> icon_urls;
516 icon_urls.push_back(icon_url); 517 icon_urls.push_back(icon_url);
517 client_->GetFaviconService()->UpdateFaviconMappingsAndFetch( 518 client_->GetFaviconService()->UpdateFaviconMappingsAndFetch(
518 page_url, icon_urls, icon_type, preferred_icon_size(), callback, tracker); 519 page_url, icon_urls, icon_type, preferred_icon_size(), callback, tracker);
519 } 520 }
520 521
521 void FaviconHandler::GetFaviconFromFaviconService( 522 void FaviconHandler::GetFaviconFromFaviconService(
522 const GURL& icon_url, 523 const GURL& icon_url,
523 favicon_base::IconType icon_type, 524 favicon_base::IconType icon_type,
524 const FaviconService::FaviconResultsCallback& callback, 525 const favicon_base::FaviconResultsCallback& callback,
525 base::CancelableTaskTracker* tracker) { 526 base::CancelableTaskTracker* tracker) {
526 client_->GetFaviconService()->GetFavicon( 527 client_->GetFaviconService()->GetFavicon(
527 icon_url, icon_type, preferred_icon_size(), callback, tracker); 528 icon_url, icon_type, preferred_icon_size(), callback, tracker);
528 } 529 }
529 530
530 void FaviconHandler::GetFaviconForURLFromFaviconService( 531 void FaviconHandler::GetFaviconForURLFromFaviconService(
531 const GURL& page_url, 532 const GURL& page_url,
532 int icon_types, 533 int icon_types,
533 const FaviconService::FaviconResultsCallback& callback, 534 const favicon_base::FaviconResultsCallback& callback,
534 base::CancelableTaskTracker* tracker) { 535 base::CancelableTaskTracker* tracker) {
535 client_->GetFaviconService()->GetFaviconForURL( 536 client_->GetFaviconService()->GetFaviconForURL(
536 FaviconService::FaviconForURLParams( 537 FaviconService::FaviconForURLParams(
537 page_url, icon_types, preferred_icon_size()), 538 page_url, icon_types, preferred_icon_size()),
538 callback, 539 callback,
539 tracker); 540 tracker);
540 } 541 }
541 542
542 void FaviconHandler::SetHistoryFavicons(const GURL& page_url, 543 void FaviconHandler::SetHistoryFavicons(const GURL& page_url,
543 const GURL& icon_url, 544 const GURL& icon_url,
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
706 } else { 707 } else {
707 gfx::Size largest = i->icon_sizes[index]; 708 gfx::Size largest = i->icon_sizes[index];
708 i->icon_sizes.clear(); 709 i->icon_sizes.clear();
709 i->icon_sizes.push_back(largest); 710 i->icon_sizes.push_back(largest);
710 ++i; 711 ++i;
711 } 712 }
712 } 713 }
713 std::stable_sort(image_urls_.begin(), image_urls_.end(), 714 std::stable_sort(image_urls_.begin(), image_urls_.end(),
714 CompareIconSize); 715 CompareIconSize);
715 } 716 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698