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

Side by Side Diff: components/favicon/core/favicon_service.cc

Issue 2665623002: Fix Jumplist favicons to have high resolution in HDPI Windows displays (Closed)
Patch Set: Add faviconSize parameter to GetFaviconImageForPageURL() Created 3 years, 10 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 "components/favicon/core/favicon_service.h" 5 #include "components/favicon/core/favicon_service.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <cmath> 8 #include <cmath>
9 #include <utility> 9 #include <utility>
10 10
11 #include "base/hash.h" 11 #include "base/hash.h"
12 #include "base/single_thread_task_runner.h" 12 #include "base/single_thread_task_runner.h"
13 #include "base/threading/thread_task_runner_handle.h" 13 #include "base/threading/thread_task_runner_handle.h"
14 #include "base/trace_event/trace_event.h" 14 #include "base/trace_event/trace_event.h"
15 #include "components/favicon/core/favicon_client.h" 15 #include "components/favicon/core/favicon_client.h"
16 #include "components/favicon_base/favicon_util.h" 16 #include "components/favicon_base/favicon_util.h"
17 #include "components/favicon_base/select_favicon_frames.h" 17 #include "components/favicon_base/select_favicon_frames.h"
18 #include "components/history/core/browser/history_service.h" 18 #include "components/history/core/browser/history_service.h"
19 #include "third_party/skia/include/core/SkBitmap.h" 19 #include "third_party/skia/include/core/SkBitmap.h"
20 #include "ui/gfx/codec/png_codec.h" 20 #include "ui/gfx/codec/png_codec.h"
21 #include "ui/gfx/favicon_size.h"
22 #include "ui/gfx/image/image_skia.h" 21 #include "ui/gfx/image/image_skia.h"
23 #include "url/gurl.h" 22 #include "url/gurl.h"
24 23
25 namespace favicon { 24 namespace favicon {
26 namespace { 25 namespace {
27 26
28 // Helper to run callback with empty results if we cannot get the history 27 // Helper to run callback with empty results if we cannot get the history
29 // service. 28 // service.
30 base::CancelableTaskTracker::TaskId RunWithEmptyResultAsync( 29 base::CancelableTaskTracker::TaskId RunWithEmptyResultAsync(
31 const favicon_base::FaviconResultsCallback& callback, 30 const favicon_base::FaviconResultsCallback& callback,
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 GetPixelSizesForFaviconScales(desired_size_in_dip), 125 GetPixelSizesForFaviconScales(desired_size_in_dip),
127 callback, 126 callback,
128 tracker); 127 tracker);
129 } 128 }
130 return RunWithEmptyResultAsync(callback, tracker); 129 return RunWithEmptyResultAsync(callback, tracker);
131 } 130 }
132 131
133 base::CancelableTaskTracker::TaskId FaviconService::GetFaviconImageForPageURL( 132 base::CancelableTaskTracker::TaskId FaviconService::GetFaviconImageForPageURL(
134 const GURL& page_url, 133 const GURL& page_url,
135 const favicon_base::FaviconImageCallback& callback, 134 const favicon_base::FaviconImageCallback& callback,
136 base::CancelableTaskTracker* tracker) { 135 base::CancelableTaskTracker* tracker,
136 const int faviconSize) {
137 TRACE_EVENT0("browser", "FaviconService::GetFaviconImageForPageURL"); 137 TRACE_EVENT0("browser", "FaviconService::GetFaviconImageForPageURL");
138 return GetFaviconForPageURLImpl( 138 return GetFaviconForPageURLImpl(
139 page_url, favicon_base::FAVICON, 139 page_url, favicon_base::FAVICON,
140 GetPixelSizesForFaviconScales(gfx::kFaviconSize), 140 GetPixelSizesForFaviconScales(faviconSize),
141 base::Bind(&FaviconService::RunFaviconImageCallbackWithBitmapResults, 141 base::Bind(&FaviconService::RunFaviconImageCallbackWithBitmapResults,
142 base::Unretained(this), callback, gfx::kFaviconSize), 142 base::Unretained(this), callback, faviconSize),
143 tracker); 143 tracker);
144 } 144 }
145 145
146 base::CancelableTaskTracker::TaskId FaviconService::GetRawFaviconForPageURL( 146 base::CancelableTaskTracker::TaskId FaviconService::GetRawFaviconForPageURL(
147 const GURL& page_url, 147 const GURL& page_url,
148 int icon_types, 148 int icon_types,
149 int desired_size_in_pixel, 149 int desired_size_in_pixel,
150 const favicon_base::FaviconRawBitmapCallback& callback, 150 const favicon_base::FaviconRawBitmapCallback& callback,
151 base::CancelableTaskTracker* tracker) { 151 base::CancelableTaskTracker* tracker) {
152 TRACE_EVENT0("browser", "FaviconService::GetRawFaviconForPageURL"); 152 TRACE_EVENT0("browser", "FaviconService::GetRawFaviconForPageURL");
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after
342 int desired_size_in_pixel, 342 int desired_size_in_pixel,
343 const std::vector<favicon_base::FaviconRawBitmapResult>& 343 const std::vector<favicon_base::FaviconRawBitmapResult>&
344 favicon_bitmap_results) { 344 favicon_bitmap_results) {
345 TRACE_EVENT0("browser", 345 TRACE_EVENT0("browser",
346 "FaviconService::RunFaviconRawBitmapCallbackWithBitmapResults"); 346 "FaviconService::RunFaviconRawBitmapCallbackWithBitmapResults");
347 callback.Run( 347 callback.Run(
348 ResizeFaviconBitmapResult(favicon_bitmap_results, desired_size_in_pixel)); 348 ResizeFaviconBitmapResult(favicon_bitmap_results, desired_size_in_pixel));
349 } 349 }
350 350
351 } // namespace favicon 351 } // namespace favicon
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698