| OLD | NEW |
| 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/extensions/image_loader.h" | 5 #include "chrome/browser/extensions/image_loader.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/callback.h" | 10 #include "base/callback.h" |
| (...skipping 316 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 327 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 327 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
| 328 | 328 |
| 329 gfx::ImageSkia image_skia; | 329 gfx::ImageSkia image_skia; |
| 330 | 330 |
| 331 for (std::vector<LoadResult>::const_iterator it = load_result->begin(); | 331 for (std::vector<LoadResult>::const_iterator it = load_result->begin(); |
| 332 it != load_result->end(); ++it) { | 332 it != load_result->end(); ++it) { |
| 333 const SkBitmap& bitmap = it->bitmap; | 333 const SkBitmap& bitmap = it->bitmap; |
| 334 const ImageRepresentation& image_rep = it->image_representation; | 334 const ImageRepresentation& image_rep = it->image_representation; |
| 335 | 335 |
| 336 image_skia.AddRepresentation(gfx::ImageSkiaRep( | 336 image_skia.AddRepresentation(gfx::ImageSkiaRep( |
| 337 bitmap, image_rep.scale_factor)); | 337 bitmap, |
| 338 ui::GetScaleFactorScale(image_rep.scale_factor))); |
| 338 } | 339 } |
| 339 | 340 |
| 340 gfx::Image image; | 341 gfx::Image image; |
| 341 if (!image_skia.isNull()) { | 342 if (!image_skia.isNull()) { |
| 342 image_skia.MakeThreadSafe(); | 343 image_skia.MakeThreadSafe(); |
| 343 image = gfx::Image(image_skia); | 344 image = gfx::Image(image_skia); |
| 344 } | 345 } |
| 345 | 346 |
| 346 callback.Run(image); | 347 callback.Run(image); |
| 347 } | 348 } |
| 348 | 349 |
| 349 } // namespace extensions | 350 } // namespace extensions |
| OLD | NEW |