| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 "ash/desktop_background/wallpaper_resizer.h" | 5 #include "ash/desktop_background/wallpaper_resizer.h" |
| 6 | 6 |
| 7 #include "ash/desktop_background/wallpaper_resizer_observer.h" | 7 #include "ash/desktop_background/wallpaper_resizer_observer.h" |
| 8 #include "ash/root_window_controller.h" | 8 #include "ash/root_window_controller.h" |
| 9 #include "ash/shell.h" | 9 #include "ash/shell.h" |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 resized_wallpaper.setImmutable(); | 88 resized_wallpaper.setImmutable(); |
| 89 origin_loop->PostTask(FROM_HERE, base::Bind(callback, resized_wallpaper)); | 89 origin_loop->PostTask(FROM_HERE, base::Bind(callback, resized_wallpaper)); |
| 90 } | 90 } |
| 91 | 91 |
| 92 } // namespace | 92 } // namespace |
| 93 | 93 |
| 94 WallpaperResizer::WallpaperResizer(const WallpaperInfo& info) | 94 WallpaperResizer::WallpaperResizer(const WallpaperInfo& info) |
| 95 : wallpaper_info_(info), | 95 : wallpaper_info_(info), |
| 96 wallpaper_image_(*(ui::ResourceBundle::GetSharedInstance(). | 96 wallpaper_image_(*(ui::ResourceBundle::GetSharedInstance(). |
| 97 GetImageNamed(info.idr).ToImageSkia())), | 97 GetImageNamed(info.idr).ToImageSkia())), |
| 98 weak_ptr_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) { | 98 weak_ptr_factory_(this) { |
| 99 } | 99 } |
| 100 | 100 |
| 101 WallpaperResizer::WallpaperResizer(const WallpaperInfo& info, | 101 WallpaperResizer::WallpaperResizer(const WallpaperInfo& info, |
| 102 const gfx::ImageSkia& image) | 102 const gfx::ImageSkia& image) |
| 103 : wallpaper_info_(info), | 103 : wallpaper_info_(info), |
| 104 wallpaper_image_(image), | 104 wallpaper_image_(image), |
| 105 weak_ptr_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) { | 105 weak_ptr_factory_(this) { |
| 106 } | 106 } |
| 107 | 107 |
| 108 WallpaperResizer::~WallpaperResizer() { | 108 WallpaperResizer::~WallpaperResizer() { |
| 109 } | 109 } |
| 110 | 110 |
| 111 void WallpaperResizer::StartResize() { | 111 void WallpaperResizer::StartResize() { |
| 112 int width = 0; | 112 int width = 0; |
| 113 int height = 0; | 113 int height = 0; |
| 114 Shell::RootWindowList root_windows = Shell::GetAllRootWindows(); | 114 Shell::RootWindowList root_windows = Shell::GetAllRootWindows(); |
| 115 for (Shell::RootWindowList::iterator iter = root_windows.begin(); | 115 for (Shell::RootWindowList::iterator iter = root_windows.begin(); |
| (...skipping 29 matching lines...) Expand all Loading... |
| 145 observers_.RemoveObserver(observer); | 145 observers_.RemoveObserver(observer); |
| 146 } | 146 } |
| 147 | 147 |
| 148 void WallpaperResizer::OnResizeFinished(const SkBitmap& resized_wallpaper) { | 148 void WallpaperResizer::OnResizeFinished(const SkBitmap& resized_wallpaper) { |
| 149 wallpaper_image_ = gfx::ImageSkia::CreateFrom1xBitmap(resized_wallpaper); | 149 wallpaper_image_ = gfx::ImageSkia::CreateFrom1xBitmap(resized_wallpaper); |
| 150 FOR_EACH_OBSERVER(WallpaperResizerObserver, observers_, | 150 FOR_EACH_OBSERVER(WallpaperResizerObserver, observers_, |
| 151 OnWallpaperResized()); | 151 OnWallpaperResized()); |
| 152 } | 152 } |
| 153 | 153 |
| 154 } // namespace ash | 154 } // namespace ash |
| OLD | NEW |