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

Side by Side Diff: chrome/browser/ui/web_applications/web_app_ui.cc

Issue 24175004: Remove dependency on ui::ScaleFactor from ui/gfx (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rename methods and vars to make image_scale more clear 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/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 341 matching lines...) Expand 10 before | Expand all | Expand 10 after
352 gfx::ImageSkia image_skia = gfx::ImageSkia::CreateFrom1xBitmap(bmp); 352 gfx::ImageSkia image_skia = gfx::ImageSkia::CreateFrom1xBitmap(bmp);
353 // We are on the UI thread, and this image is needed from the FILE thread, 353 // We are on the UI thread, and this image is needed from the FILE thread,
354 // for creating shortcut icon files. 354 // for creating shortcut icon files.
355 image_skia.MakeThreadSafe(); 355 image_skia.MakeThreadSafe();
356 shortcut_info.favicon.Add(gfx::Image(image_skia)); 356 shortcut_info.favicon.Add(gfx::Image(image_skia));
357 } else { 357 } else {
358 // As described in UpdateShortcutInfoAndIconForApp, image contains all of 358 // As described in UpdateShortcutInfoAndIconForApp, image contains all of
359 // the icons, hackily put into a single ImageSkia. Separate them out into 359 // the icons, hackily put into a single ImageSkia. Separate them out into
360 // individual ImageSkias and insert them into the icon family. 360 // individual ImageSkias and insert them into the icon family.
361 const gfx::ImageSkia& multires_image_skia = image.AsImageSkia(); 361 const gfx::ImageSkia& multires_image_skia = image.AsImageSkia();
362 // NOTE: We do not call ImageSkia::EnsureRepsForSupportedScaleFactors here. 362 // NOTE: We do not call ImageSkia::EnsureRepsForSupportedScales here.
363 // The image reps here are not really for different scale factors (ImageSkia 363 // The image reps here are not really for different scale factors (ImageSkia
364 // is just being used as a handy container for multiple images). 364 // is just being used as a handy container for multiple images).
365 std::vector<gfx::ImageSkiaRep> image_reps = 365 std::vector<gfx::ImageSkiaRep> image_reps =
366 multires_image_skia.image_reps(); 366 multires_image_skia.image_reps();
367 for (std::vector<gfx::ImageSkiaRep>::const_iterator it = image_reps.begin(); 367 for (std::vector<gfx::ImageSkiaRep>::const_iterator it = image_reps.begin();
368 it != image_reps.end(); ++it) { 368 it != image_reps.end(); ++it) {
369 gfx::ImageSkia image_skia(*it); 369 gfx::ImageSkia image_skia(*it);
370 image_skia.MakeThreadSafe(); 370 image_skia.MakeThreadSafe();
371 shortcut_info.favicon.Add(image_skia); 371 shortcut_info.favicon.Add(image_skia);
372 } 372 }
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
483 } 483 }
484 484
485 // |info_list| may still be empty at this point, in which case LoadImage 485 // |info_list| may still be empty at this point, in which case LoadImage
486 // will call the OnImageLoaded callback with an empty image and exit 486 // will call the OnImageLoaded callback with an empty image and exit
487 // immediately. 487 // immediately.
488 extensions::ImageLoader::Get(profile)->LoadImagesAsync(&extension, info_list, 488 extensions::ImageLoader::Get(profile)->LoadImagesAsync(&extension, info_list,
489 base::Bind(&OnImageLoaded, shortcut_info, callback)); 489 base::Bind(&OnImageLoaded, shortcut_info, callback));
490 } 490 }
491 491
492 } // namespace web_app 492 } // namespace web_app
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698