summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormichaelbai@chromium.org <michaelbai@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-10-25 19:16:40 +0000
committermichaelbai@chromium.org <michaelbai@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-10-25 19:16:40 +0000
commitb15a08ac0f726393605383e242e8d9b6c35acdeb (patch)
treea335b59caee13ce115a30931056f91b4b41afe71
parent6651fd318485c67872b0ca42ae947d1de8d1dead (diff)
downloadchromium_src-b15a08ac0f726393605383e242e8d9b6c35acdeb.zip
chromium_src-b15a08ac0f726393605383e242e8d9b6c35acdeb.tar.gz
chromium_src-b15a08ac0f726393605383e242e8d9b6c35acdeb.tar.bz2
Download and store large favicon for Android.
BUG=298446 Review URL: https://codereview.chromium.org/28943004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@231074 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/favicon/favicon_handler.cc20
-rw-r--r--chrome/browser/favicon/favicon_handler.h4
-rw-r--r--chrome/browser/favicon/favicon_handler_unittest.cc4
3 files changed, 18 insertions, 10 deletions
diff --git a/chrome/browser/favicon/favicon_handler.cc b/chrome/browser/favicon/favicon_handler.cc
index 5e1459c..57575cf 100644
--- a/chrome/browser/favicon/favicon_handler.cc
+++ b/chrome/browser/favicon/favicon_handler.cc
@@ -32,7 +32,7 @@ namespace {
// Size (along each axis) of a touch icon. This currently corresponds to
// the apple touch icon for iPad.
-const int kTouchIconSize = 72;
+const int kTouchIconSize = 144;
// Returns chrome::IconType the given icon_type corresponds to.
chrome::IconType ToHistoryIconType(FaviconURL::IconType icon_type) {
@@ -47,27 +47,27 @@ chrome::IconType ToHistoryIconType(FaviconURL::IconType icon_type) {
return chrome::INVALID_ICON;
}
NOTREACHED();
- // Shouldn't reach here, just make compiler happy.
return chrome::INVALID_ICON;
}
// Get the maximal icon size in pixels for a icon of type |icon_type| for the
// current platform.
int GetMaximalIconSize(chrome::IconType icon_type) {
- int base_size = 0;
switch (icon_type) {
case chrome::FAVICON:
- base_size = gfx::kFaviconSize;
- break;
+#if defined(OS_ANDROID)
+ return 192;
+#else
+ return gfx::ImageSkia::GetMaxSupportedScale() * gfx::kFaviconSize;
+#endif
case chrome::TOUCH_ICON:
case chrome::TOUCH_PRECOMPOSED_ICON:
- base_size = kTouchIconSize;
- break;
+ return kTouchIconSize;
case chrome::INVALID_ICON:
- base_size = 0;
- break;
+ return 0;
}
- return gfx::ImageSkia::GetMaxSupportedScale() * base_size;
+ NOTREACHED();
+ return 0;
}
bool DoUrlAndIconMatch(const FaviconURL& favicon_url,
diff --git a/chrome/browser/favicon/favicon_handler.h b/chrome/browser/favicon/favicon_handler.h
index 4feed38..91e8e8f 100644
--- a/chrome/browser/favicon/favicon_handler.h
+++ b/chrome/browser/favicon/favicon_handler.h
@@ -245,7 +245,11 @@ class FaviconHandler {
// Returns the preferred_icon_size according icon_types_, 0 means no
// preference.
int preferred_icon_size() {
+#if defined(OS_ANDROID)
+ return 0;
+#else
return icon_types_ == chrome::FAVICON ? gfx::kFaviconSize : 0;
+#endif
}
// Used for FaviconService requests.
diff --git a/chrome/browser/favicon/favicon_handler_unittest.cc b/chrome/browser/favicon/favicon_handler_unittest.cc
index 5671b73..40d0255 100644
--- a/chrome/browser/favicon/favicon_handler_unittest.cc
+++ b/chrome/browser/favicon/favicon_handler_unittest.cc
@@ -974,6 +974,8 @@ TEST_F(FaviconHandlerTest, UpdateDuringDownloading) {
EXPECT_FALSE(download_handler->HasDownload());
}
+#if !defined(OS_ANDROID)
+
// Test the favicon which is selected when the web page provides several
// favicons and none of the favicons are cached in history.
// The goal of this test is to be more of an integration test than
@@ -1063,6 +1065,8 @@ TEST_F(FaviconHandlerTest, MultipleFavicons) {
handler4.GetEntry()->GetFavicon().url);
}
+#endif
+
static BrowserContextKeyedService* BuildFaviconService(
content::BrowserContext* profile) {
return new FaviconService(NULL);