Chromium Code Reviews| 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_handler.h" | 5 #include "components/favicon/core/favicon_handler.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <cmath> | 8 #include <cmath> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 207 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 218 | 218 |
| 219 FaviconHandler::~FaviconHandler() { | 219 FaviconHandler::~FaviconHandler() { |
| 220 } | 220 } |
| 221 | 221 |
| 222 // static | 222 // static |
| 223 int FaviconHandler::GetIconTypesFromHandlerType( | 223 int FaviconHandler::GetIconTypesFromHandlerType( |
| 224 FaviconHandler::Type handler_type) { | 224 FaviconHandler::Type handler_type) { |
| 225 switch (handler_type) { | 225 switch (handler_type) { |
| 226 case FAVICON: | 226 case FAVICON: |
| 227 return favicon_base::FAVICON; | 227 return favicon_base::FAVICON; |
| 228 case TOUCH: // Falls through. | 228 case TOUCH: |
| 229 case LARGE: | |
| 230 return favicon_base::TOUCH_ICON | favicon_base::TOUCH_PRECOMPOSED_ICON; | 229 return favicon_base::TOUCH_ICON | favicon_base::TOUCH_PRECOMPOSED_ICON; |
| 231 default: | 230 default: |
| 232 NOTREACHED(); | 231 NOTREACHED(); |
| 233 } | 232 } |
| 234 return 0; | 233 return 0; |
| 235 } | 234 } |
| 236 | 235 |
| 237 void FaviconHandler::FetchFavicon(const GURL& url) { | 236 void FaviconHandler::FetchFavicon(const GURL& url) { |
| 238 cancelable_task_tracker_.TryCancelAll(); | 237 cancelable_task_tracker_.TryCancelAll(); |
| 239 | 238 |
| (...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 535 if (!driver_->IsOffTheRecord()) | 534 if (!driver_->IsOffTheRecord()) |
| 536 return true; | 535 return true; |
| 537 | 536 |
| 538 // Always save favicon if the page is bookmarked. | 537 // Always save favicon if the page is bookmarked. |
| 539 return driver_->IsBookmarked(url); | 538 return driver_->IsBookmarked(url); |
| 540 } | 539 } |
| 541 | 540 |
| 542 int FaviconHandler::GetMaximalIconSize(favicon_base::IconType icon_type) { | 541 int FaviconHandler::GetMaximalIconSize(favicon_base::IconType icon_type) { |
| 543 switch (icon_type) { | 542 switch (icon_type) { |
| 544 case favicon_base::FAVICON: | 543 case favicon_base::FAVICON: |
| 545 #if defined(OS_ANDROID) | 544 #if defined(OS_ANDROID) |
|
huangs
2015/04/30 20:23:41
Can we remove the OS_ANDROID case?
| |
| 546 return 192; | 545 return 192; |
| 547 #else | 546 #else |
| 547 if (download_largest_icon_) | |
| 548 return 192; | |
| 548 return gfx::ImageSkia::GetMaxSupportedScale() * gfx::kFaviconSize; | 549 return gfx::ImageSkia::GetMaxSupportedScale() * gfx::kFaviconSize; |
| 549 #endif | 550 #endif |
| 550 case favicon_base::TOUCH_ICON: | 551 case favicon_base::TOUCH_ICON: |
| 551 case favicon_base::TOUCH_PRECOMPOSED_ICON: | 552 case favicon_base::TOUCH_PRECOMPOSED_ICON: |
| 552 return kTouchIconSize; | 553 return kTouchIconSize; |
| 553 case favicon_base::INVALID_ICON: | 554 case favicon_base::INVALID_ICON: |
| 554 return 0; | 555 return 0; |
| 555 } | 556 } |
| 556 NOTREACHED(); | 557 NOTREACHED(); |
| 557 return 0; | 558 return 0; |
| (...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 706 gfx::Size largest = | 707 gfx::Size largest = |
| 707 image_url.icon_sizes[GetLargestSizeIndex(image_url.icon_sizes)]; | 708 image_url.icon_sizes[GetLargestSizeIndex(image_url.icon_sizes)]; |
| 708 image_url.icon_sizes.clear(); | 709 image_url.icon_sizes.clear(); |
| 709 image_url.icon_sizes.push_back(largest); | 710 image_url.icon_sizes.push_back(largest); |
| 710 } | 711 } |
| 711 std::stable_sort(image_urls_.begin(), image_urls_.end(), | 712 std::stable_sort(image_urls_.begin(), image_urls_.end(), |
| 712 CompareIconSize); | 713 CompareIconSize); |
| 713 } | 714 } |
| 714 | 715 |
| 715 } // namespace favicon | 716 } // namespace favicon |
| OLD | NEW |