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

Side by Side Diff: chrome/browser/favicon/favicon_service.cc

Issue 24175004: Remove dependency on ui::ScaleFactor from ui/gfx (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 3 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 | Annotate | Revision Log
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 "chrome/browser/favicon/favicon_service.h" 5 #include "chrome/browser/favicon/favicon_service.h"
6 6
7 #include "base/hash.h" 7 #include "base/hash.h"
8 #include "base/message_loop/message_loop_proxy.h" 8 #include "base/message_loop/message_loop_proxy.h"
9 #include "chrome/browser/favicon/favicon_util.h" 9 #include "chrome/browser/favicon/favicon_util.h"
10 #include "chrome/browser/history/history_backend.h" 10 #include "chrome/browser/history/history_backend.h"
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 } 231 }
232 232
233 void FaviconService::SetFavicons(const GURL& page_url, 233 void FaviconService::SetFavicons(const GURL& page_url,
234 const GURL& icon_url, 234 const GURL& icon_url,
235 chrome::IconType icon_type, 235 chrome::IconType icon_type,
236 const gfx::Image& image) { 236 const gfx::Image& image) {
237 if (!history_service_) 237 if (!history_service_)
238 return; 238 return;
239 239
240 gfx::ImageSkia image_skia = image.AsImageSkia(); 240 gfx::ImageSkia image_skia = image.AsImageSkia();
241 image_skia.EnsureRepsForSupportedScaleFactors(); 241 image_skia.EnsureRepsForSupportedScales();
242 const std::vector<gfx::ImageSkiaRep>& image_reps = image_skia.image_reps(); 242 const std::vector<gfx::ImageSkiaRep>& image_reps = image_skia.image_reps();
243 std::vector<chrome::FaviconBitmapData> favicon_bitmap_data; 243 std::vector<chrome::FaviconBitmapData> favicon_bitmap_data;
244 for (size_t i = 0; i < image_reps.size(); ++i) { 244 for (size_t i = 0; i < image_reps.size(); ++i) {
245 scoped_refptr<base::RefCountedBytes> bitmap_data( 245 scoped_refptr<base::RefCountedBytes> bitmap_data(
246 new base::RefCountedBytes()); 246 new base::RefCountedBytes());
247 if (gfx::PNGCodec::EncodeBGRASkBitmap(image_reps[i].sk_bitmap(), 247 if (gfx::PNGCodec::EncodeBGRASkBitmap(image_reps[i].sk_bitmap(),
248 false, 248 false,
249 &bitmap_data->data())) { 249 &bitmap_data->data())) {
250 gfx::Size pixel_size(image_reps[i].pixel_width(), 250 gfx::Size pixel_size(image_reps[i].pixel_width(),
251 image_reps[i].pixel_height()); 251 image_reps[i].pixel_height());
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
364 if (!gfx::PNGCodec::EncodeBGRASkBitmap(resized_image.AsBitmap(), false, 364 if (!gfx::PNGCodec::EncodeBGRASkBitmap(resized_image.AsBitmap(), false,
365 &resized_bitmap_data)) { 365 &resized_bitmap_data)) {
366 callback.Run(chrome::FaviconBitmapResult()); 366 callback.Run(chrome::FaviconBitmapResult());
367 return; 367 return;
368 } 368 }
369 369
370 bitmap_result.bitmap_data = base::RefCountedBytes::TakeVector( 370 bitmap_result.bitmap_data = base::RefCountedBytes::TakeVector(
371 &resized_bitmap_data); 371 &resized_bitmap_data);
372 callback.Run(bitmap_result); 372 callback.Run(bitmap_result);
373 } 373 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698