| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/wallpaper/wallpaper_manager_base.h" | 5 #include "components/wallpaper/wallpaper_manager_base.h" |
| 6 | 6 |
| 7 #include <numeric> | 7 #include <numeric> |
| 8 #include <vector> | 8 #include <vector> |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 923 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 934 | 934 |
| 935 wallpaper->image().EnsureRepsForSupportedScales(); | 935 wallpaper->image().EnsureRepsForSupportedScales(); |
| 936 // TODO(crbug.com/593251): DeepCopy() may be unnecessary as this function | 936 // TODO(crbug.com/593251): DeepCopy() may be unnecessary as this function |
| 937 // owns |wallpaper| as scoped_ptr whereas it used to be a const reference. | 937 // owns |wallpaper| as scoped_ptr whereas it used to be a const reference. |
| 938 std::unique_ptr<gfx::ImageSkia> deep_copy(wallpaper->image().DeepCopy()); | 938 std::unique_ptr<gfx::ImageSkia> deep_copy(wallpaper->image().DeepCopy()); |
| 939 | 939 |
| 940 std::unique_ptr<bool> success(new bool(false)); | 940 std::unique_ptr<bool> success(new bool(false)); |
| 941 std::unique_ptr<gfx::ImageSkia> small_wallpaper_image(new gfx::ImageSkia); | 941 std::unique_ptr<gfx::ImageSkia> small_wallpaper_image(new gfx::ImageSkia); |
| 942 std::unique_ptr<gfx::ImageSkia> large_wallpaper_image(new gfx::ImageSkia); | 942 std::unique_ptr<gfx::ImageSkia> large_wallpaper_image(new gfx::ImageSkia); |
| 943 | 943 |
| 944 // TODO(bshe): This may break if Bytes becomes RefCountedMemory. | |
| 945 base::Closure resize_closure = base::Bind( | 944 base::Closure resize_closure = base::Bind( |
| 946 &WallpaperManagerBase::ResizeCustomizedDefaultWallpaper, | 945 &WallpaperManagerBase::ResizeCustomizedDefaultWallpaper, |
| 947 base::Passed(&deep_copy), | 946 base::Passed(&deep_copy), |
| 948 base::Unretained(rescaled_files.get()), base::Unretained(success.get()), | 947 base::Unretained(rescaled_files.get()), base::Unretained(success.get()), |
| 949 base::Unretained(small_wallpaper_image.get()), | 948 base::Unretained(small_wallpaper_image.get()), |
| 950 base::Unretained(large_wallpaper_image.get())); | 949 base::Unretained(large_wallpaper_image.get())); |
| 951 base::Closure on_resized_closure = base::Bind( | 950 base::Closure on_resized_closure = base::Bind( |
| 952 &WallpaperManagerBase::OnCustomizedDefaultWallpaperResized, | 951 &WallpaperManagerBase::OnCustomizedDefaultWallpaperResized, |
| 953 weak_factory_.GetWeakPtr(), wallpaper_url, | 952 weak_factory_.GetWeakPtr(), wallpaper_url, |
| 954 base::Passed(std::move(rescaled_files)), base::Passed(std::move(success)), | 953 base::Passed(std::move(rescaled_files)), base::Passed(std::move(success)), |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1020 void WallpaperManagerBase::CreateSolidDefaultWallpaper() { | 1019 void WallpaperManagerBase::CreateSolidDefaultWallpaper() { |
| 1021 loaded_wallpapers_for_test_++; | 1020 loaded_wallpapers_for_test_++; |
| 1022 SkBitmap bitmap; | 1021 SkBitmap bitmap; |
| 1023 bitmap.allocN32Pixels(1, 1); | 1022 bitmap.allocN32Pixels(1, 1); |
| 1024 bitmap.eraseColor(kDefaultWallpaperColor); | 1023 bitmap.eraseColor(kDefaultWallpaperColor); |
| 1025 const gfx::ImageSkia image = gfx::ImageSkia::CreateFrom1xBitmap(bitmap); | 1024 const gfx::ImageSkia image = gfx::ImageSkia::CreateFrom1xBitmap(bitmap); |
| 1026 default_wallpaper_image_.reset(new user_manager::UserImage(image)); | 1025 default_wallpaper_image_.reset(new user_manager::UserImage(image)); |
| 1027 } | 1026 } |
| 1028 | 1027 |
| 1029 } // namespace wallpaper | 1028 } // namespace wallpaper |
| OLD | NEW |