summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--build/android/gtest_filter/unit_tests_disabled3
-rw-r--r--chrome/browser/favicon/favicon_service.cc27
-rw-r--r--chrome/browser/favicon/favicon_service.h33
-rw-r--r--chrome/browser/history/android/sqlite_cursor.cc4
4 files changed, 35 insertions, 32 deletions
diff --git a/build/android/gtest_filter/unit_tests_disabled b/build/android/gtest_filter/unit_tests_disabled
index 6a22852..c5b8f58 100644
--- a/build/android/gtest_filter/unit_tests_disabled
+++ b/build/android/gtest_filter/unit_tests_disabled
@@ -138,9 +138,6 @@ AutofillManagerTest.UpdatePasswordGenerationState
# crbug.com/144227
ExtensionIconImageTest.*
-# crbug.com/145799
-SQLiteCursorTest.Run
-
# crbug.com/145843
EntropyProviderTest.UseOneTimeRandomizationSHA1
EntropyProviderTest.UseOneTimeRandomizationPermuted
diff --git a/chrome/browser/favicon/favicon_service.cc b/chrome/browser/favicon/favicon_service.cc
index a968c67..32145d3 100644
--- a/chrome/browser/favicon/favicon_service.cc
+++ b/chrome/browser/favicon/favicon_service.cc
@@ -131,17 +131,17 @@ FaviconService::Handle FaviconService::GetFaviconForURL(
return GetFaviconForURLImpl(params, desired_scale_factors, request);
}
-FaviconService::Handle FaviconService::GetRawFaviconForID(
- history::FaviconID favicon_id,
- int desired_size_in_dip,
- ui::ScaleFactor desired_scale_factor,
- CancelableRequestConsumerBase* consumer,
- const FaviconRawCallback& callback) {
- GetFaviconRequest* request = new GetFaviconRequest(base::Bind(
+FaviconService::Handle FaviconService::GetLargestRawFaviconForID(
+ history::FaviconID favicon_id,
+ CancelableRequestConsumerBase* consumer,
+ const FaviconRawCallback& callback) {
+ // Use 0 as |desired_size_in_dip| to get the largest bitmap for |favicon_id|
+ // without any resizing.
+ GetFaviconRequest* request = new GetFaviconRequest(base::Bind(
&FaviconService::GetRawFaviconCallback,
base::Unretained(this),
- desired_size_in_dip,
- desired_scale_factor,
+ 0,
+ ui::SCALE_FACTOR_100P,
callback));
AddRequest(request, consumer);
@@ -155,7 +155,6 @@ FaviconService::Handle FaviconService::GetRawFaviconForID(
return handle;
}
-
void FaviconService::SetFaviconOutOfDateForPage(const GURL& page_url) {
if (history_service_)
history_service_->SetFaviconOutOfDateForPage(page_url);
@@ -238,6 +237,14 @@ void FaviconService::GetRawFaviconCallback(
DCHECK_EQ(1u, favicon_bitmap_results.size());
history::FaviconBitmapResult bitmap_result = favicon_bitmap_results[0];
+ // If the desired size is 0, SelectFaviconFrames() will return the largest
+ // bitmap without doing any resizing. As |favicon_bitmap_results| has bitmap
+ // data for a single bitmap, return it and avoid an unnecessary decode.
+ if (desired_size_in_dip == 0) {
+ callback.Run(handle, bitmap_result);
+ return;
+ }
+
// If history bitmap is already desired pixel size, return early.
float desired_scale = ui::GetScaleFactorScale(desired_scale_factor);
int desired_edge_width_in_pixel = static_cast<int>(
diff --git a/chrome/browser/favicon/favicon_service.h b/chrome/browser/favicon/favicon_service.h
index b820220..3e95786 100644
--- a/chrome/browser/favicon/favicon_service.h
+++ b/chrome/browser/favicon/favicon_service.h
@@ -100,8 +100,9 @@ class FaviconService : public CancelableRequestProvider,
typedef CancelableRequest<FaviconResultsCallback> GetFaviconRequest;
// Requests the favicon at |icon_url| of |icon_type| whose size most closely
- // matches |desired_size_in_dip|. |consumer| is notified when the bits have
- // been fetched. |icon_url| is the URL of the icon itself, e.g.
+ // matches |desired_size_in_dip|. If |desired_size_in_dip| is 0, the largest
+ // favicon bitmap at |icon_url| is returned. |consumer| is notified when the
+ // bits have been fetched. |icon_url| is the URL of the icon itself, e.g.
// <http://www.google.com/favicon.ico>.
// Each of the three methods below differs in the format of the callback and
// the requested scale factors. All of the scale factors supported by the
@@ -139,12 +140,13 @@ class FaviconService : public CancelableRequestProvider,
// Requests the favicons of any of |icon_types| whose pixel sizes most
// closely match |desired_size_in_dip| and desired scale factors for a web
- // page URL. |consumer| is notified when the bits have been fetched.
- // |icon_types| can be any combination of IconType value, but only one icon
- // will be returned in the priority of TOUCH_PRECOMPOSED_ICON, TOUCH_ICON
- // and FAVICON. Each of the three methods below differs in the format of the
- // callback and the requested scale factors. All of the scale factors
- // supported by the current platform (eg MacOS) are requested for
+ // page URL. If |desired_size_in_dip| is 0, the largest favicon for the web
+ // page URL is returned. |consumer| is notified when the bits have been
+ // fetched. |icon_types| can be any combination of IconType value, but only
+ // one icon will be returned in the priority of TOUCH_PRECOMPOSED_ICON,
+ // TOUCH_ICON and FAVICON. Each of the three methods below differs in the
+ // format of the callback and the requested scale factors. All of the scale
+ // factors supported by the current platform (eg MacOS) are requested for
// GetFaviconImageForURL().
Handle GetFaviconImageForURL(const FaviconForURLParams& params,
const FaviconImageCallback& callback);
@@ -158,14 +160,13 @@ class FaviconService : public CancelableRequestProvider,
const std::vector<ui::ScaleFactor>& desired_scale_factors,
const FaviconResultsCallback& callback);
- // Requests the favicon for |favicon_id| which most closely matches
- // |desired_size_in_dip| and |desired_scale_factor|. The |consumer| is
- // notified when the bits have been fetched.
- Handle GetRawFaviconForID(history::FaviconID favicon_id,
- int desired_size_in_dip,
- ui::ScaleFactor desired_scale_factor,
- CancelableRequestConsumerBase* consumer,
- const FaviconRawCallback& callback);
+ // Used to request a bitmap for the favicon with |favicon_id| which is not
+ // resized from the size it is stored at in the database. If there are
+ // multiple favicon bitmaps for |favicon_id|, the largest favicon bitmap is
+ // returned.
+ Handle GetLargestRawFaviconForID(history::FaviconID favicon_id,
+ CancelableRequestConsumerBase* consumer,
+ const FaviconRawCallback& callback);
// Marks all types of favicon for the page as being out of date.
void SetFaviconOutOfDateForPage(const GURL& page_url);
diff --git a/chrome/browser/history/android/sqlite_cursor.cc b/chrome/browser/history/android/sqlite_cursor.cc
index a350daa..786e157 100644
--- a/chrome/browser/history/android/sqlite_cursor.cc
+++ b/chrome/browser/history/android/sqlite_cursor.cc
@@ -11,7 +11,6 @@
#include "chrome/browser/history/android/android_history_types.h"
#include "content/public/browser/browser_thread.h"
#include "jni/SQLiteCursor_jni.h"
-#include "ui/gfx/favicon_size.h"
#include "sql/statement.h"
using base::android::ConvertUTF8ToJavaString;
@@ -241,8 +240,7 @@ void SQLiteCursor::GetFaviconForIDInUIThread(
CancelableRequestConsumerBase* consumer,
const FaviconService::FaviconRawCallback& callback) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
- favicon_service_->GetRawFaviconForID(id, gfx::kFaviconSize,
- ui::SCALE_FACTOR_100P, consumer, callback);
+ favicon_service_->GetLargestRawFaviconForID(id, consumer, callback);
}