| 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/ui/web_applications/web_app_ui.h" | 5 #include "chrome/browser/ui/web_applications/web_app_ui.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/bind_helpers.h" | 8 #include "base/bind_helpers.h" |
| 9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
| 10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
| (...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 357 gfx::ImageSkia image_skia = gfx::ImageSkia::CreateFrom1xBitmap(bmp); | 357 gfx::ImageSkia image_skia = gfx::ImageSkia::CreateFrom1xBitmap(bmp); |
| 358 // We are on the UI thread, and this image is needed from the FILE thread, | 358 // We are on the UI thread, and this image is needed from the FILE thread, |
| 359 // for creating shortcut icon files. | 359 // for creating shortcut icon files. |
| 360 image_skia.MakeThreadSafe(); | 360 image_skia.MakeThreadSafe(); |
| 361 shortcut_info.favicon.Add(gfx::Image(image_skia)); | 361 shortcut_info.favicon.Add(gfx::Image(image_skia)); |
| 362 } else { | 362 } else { |
| 363 // As described in UpdateShortcutInfoAndIconForApp, image contains all of | 363 // As described in UpdateShortcutInfoAndIconForApp, image contains all of |
| 364 // the icons, hackily put into a single ImageSkia. Separate them out into | 364 // the icons, hackily put into a single ImageSkia. Separate them out into |
| 365 // individual ImageSkias and insert them into the icon family. | 365 // individual ImageSkias and insert them into the icon family. |
| 366 const gfx::ImageSkia& multires_image_skia = image.AsImageSkia(); | 366 const gfx::ImageSkia& multires_image_skia = image.AsImageSkia(); |
| 367 // NOTE: We do not call ImageSkia::EnsureRepsForSupportedScaleFactors here. | 367 // NOTE: We do not call ImageSkia::EnsureRepsForSupportedScales here. |
| 368 // The image reps here are not really for different scale factors (ImageSkia | 368 // The image reps here are not really for different scale factors (ImageSkia |
| 369 // is just being used as a handy container for multiple images). | 369 // is just being used as a handy container for multiple images). |
| 370 std::vector<gfx::ImageSkiaRep> image_reps = | 370 std::vector<gfx::ImageSkiaRep> image_reps = |
| 371 multires_image_skia.image_reps(); | 371 multires_image_skia.image_reps(); |
| 372 for (std::vector<gfx::ImageSkiaRep>::const_iterator it = image_reps.begin(); | 372 for (std::vector<gfx::ImageSkiaRep>::const_iterator it = image_reps.begin(); |
| 373 it != image_reps.end(); ++it) { | 373 it != image_reps.end(); ++it) { |
| 374 gfx::ImageSkia image_skia(*it); | 374 gfx::ImageSkia image_skia(*it); |
| 375 image_skia.MakeThreadSafe(); | 375 image_skia.MakeThreadSafe(); |
| 376 shortcut_info.favicon.Add(image_skia); | 376 shortcut_info.favicon.Add(image_skia); |
| 377 } | 377 } |
| (...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 488 } | 488 } |
| 489 | 489 |
| 490 // |info_list| may still be empty at this point, in which case LoadImage | 490 // |info_list| may still be empty at this point, in which case LoadImage |
| 491 // will call the OnImageLoaded callback with an empty image and exit | 491 // will call the OnImageLoaded callback with an empty image and exit |
| 492 // immediately. | 492 // immediately. |
| 493 extensions::ImageLoader::Get(profile)->LoadImagesAsync(&extension, info_list, | 493 extensions::ImageLoader::Get(profile)->LoadImagesAsync(&extension, info_list, |
| 494 base::Bind(&OnImageLoaded, shortcut_info, callback)); | 494 base::Bind(&OnImageLoaded, shortcut_info, callback)); |
| 495 } | 495 } |
| 496 | 496 |
| 497 } // namespace web_app | 497 } // namespace web_app |
| OLD | NEW |