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

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

Issue 255843002: Renamed FaviconHandlerDelegate to FaviconDriver. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 8 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>
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after
234 favicon_base::IconType icon_type) 234 favicon_base::IconType icon_type)
235 : url(url), 235 : url(url),
236 image_url(image_url), 236 image_url(image_url),
237 image(image), 237 image(image),
238 score(score), 238 score(score),
239 icon_type(icon_type) {} 239 icon_type(icon_type) {}
240 240
241 //////////////////////////////////////////////////////////////////////////////// 241 ////////////////////////////////////////////////////////////////////////////////
242 242
243 FaviconHandler::FaviconHandler(FaviconClient* client, 243 FaviconHandler::FaviconHandler(FaviconClient* client,
244 FaviconHandlerDelegate* delegate, 244 FaviconDriver* delegate,
245 Type icon_type, 245 Type icon_type,
246 bool download_largest_icon) 246 bool download_largest_icon)
247 : got_favicon_from_history_(false), 247 : got_favicon_from_history_(false),
248 favicon_expired_or_incomplete_(false), 248 favicon_expired_or_incomplete_(false),
249 icon_types_(icon_type == FAVICON 249 icon_types_(icon_type == FAVICON
250 ? favicon_base::FAVICON 250 ? favicon_base::FAVICON
251 : favicon_base::TOUCH_ICON | 251 : favicon_base::TOUCH_ICON |
252 favicon_base::TOUCH_PRECOMPOSED_ICON), 252 favicon_base::TOUCH_PRECOMPOSED_ICON),
253 download_largest_icon_(download_largest_icon), 253 download_largest_icon_(download_largest_icon),
254 client_(client), 254 client_(client),
(...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after
682 ScheduleDownload(entry->GetURL(), current_candidate()->icon_url, 682 ScheduleDownload(entry->GetURL(), current_candidate()->icon_url,
683 ToChromeIconType(current_candidate()->icon_type)); 683 ToChromeIconType(current_candidate()->icon_type));
684 } 684 }
685 history_results_ = favicon_bitmap_results; 685 history_results_ = favicon_bitmap_results;
686 } 686 }
687 687
688 int FaviconHandler::ScheduleDownload(const GURL& url, 688 int FaviconHandler::ScheduleDownload(const GURL& url,
689 const GURL& image_url, 689 const GURL& image_url,
690 favicon_base::IconType icon_type) { 690 favicon_base::IconType icon_type) {
691 // A max bitmap size is specified to avoid receiving huge bitmaps in 691 // A max bitmap size is specified to avoid receiving huge bitmaps in
692 // OnDidDownloadFavicon(). See FaviconHandlerDelegate::StartDownload() 692 // OnDidDownloadFavicon(). See FaviconDriver::StartDownload()
693 // for more details about the max bitmap size. 693 // for more details about the max bitmap size.
694 const int download_id = DownloadFavicon(image_url, 694 const int download_id = DownloadFavicon(image_url,
695 GetMaximalIconSize(icon_type)); 695 GetMaximalIconSize(icon_type));
696 if (download_id) { 696 if (download_id) {
697 // Download ids should be unique. 697 // Download ids should be unique.
698 DCHECK(download_requests_.find(download_id) == download_requests_.end()); 698 DCHECK(download_requests_.find(download_id) == download_requests_.end());
699 download_requests_[download_id] = 699 download_requests_[download_id] =
700 DownloadRequest(url, image_url, icon_type); 700 DownloadRequest(url, image_url, icon_type);
701 } 701 }
702 702
(...skipping 14 matching lines...) Expand all
717 } else { 717 } else {
718 gfx::Size largest = i->icon_sizes[index]; 718 gfx::Size largest = i->icon_sizes[index];
719 i->icon_sizes.clear(); 719 i->icon_sizes.clear();
720 i->icon_sizes.push_back(largest); 720 i->icon_sizes.push_back(largest);
721 ++i; 721 ++i;
722 } 722 }
723 } 723 }
724 std::stable_sort(image_urls_.begin(), image_urls_.end(), 724 std::stable_sort(image_urls_.begin(), image_urls_.end(),
725 CompareIconSize); 725 CompareIconSize);
726 } 726 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698