summaryrefslogtreecommitdiffstats
path: root/chrome/browser/favicon/favicon_service.cc
diff options
context:
space:
mode:
authorpkotwicz@chromium.org <pkotwicz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-09-07 07:11:19 +0000
committerpkotwicz@chromium.org <pkotwicz@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-09-07 07:11:19 +0000
commit23a619b96fe4ff248ce784714ecb6ac907e92410 (patch)
tree0bd9e8531ddb225c9847ecd0d0ea9fa65115bcfb /chrome/browser/favicon/favicon_service.cc
parente9cb0b79ae9ee9c9b67969ba113a02a34fe8ec12 (diff)
downloadchromium_src-23a619b96fe4ff248ce784714ecb6ac907e92410.zip
chromium_src-23a619b96fe4ff248ce784714ecb6ac907e92410.tar.gz
chromium_src-23a619b96fe4ff248ce784714ecb6ac907e92410.tar.bz2
Fix FaviconHandler::GetRawFaviconForID
The Android API needs to be able to insert and retrieve arbitrary favicons from the history backend. http://codereview.chromium.org/10891007/ changed the API such that it returns favicons resized to 16x16 which broke the API. This changes GetRawFaviconForID to return unresized favicons and renames the method to GetLargestRawFaviconForID. Bug=145799 Test=SQLiteCursorTest passes Review URL: https://chromiumcodereview.appspot.com/10916144 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@155353 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/favicon/favicon_service.cc')
-rw-r--r--chrome/browser/favicon/favicon_service.cc27
1 files changed, 17 insertions, 10 deletions
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>(