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 "ash/desktop_background/desktop_background_controller.h" | 5 #include "ash/desktop_background/desktop_background_controller.h" |
6 | 6 |
7 #include "ash/desktop_background/desktop_background_controller_observer.h" | 7 #include "ash/desktop_background/desktop_background_controller_observer.h" |
8 #include "ash/desktop_background/desktop_background_view.h" | 8 #include "ash/desktop_background/desktop_background_view.h" |
9 #include "ash/desktop_background/desktop_background_widget_controller.h" | 9 #include "ash/desktop_background/desktop_background_widget_controller.h" |
10 #include "ash/desktop_background/user_wallpaper_delegate.h" | 10 #include "ash/desktop_background/user_wallpaper_delegate.h" |
11 #include "ash/root_window_controller.h" | 11 #include "ash/root_window_controller.h" |
12 #include "ash/shell.h" | 12 #include "ash/shell.h" |
13 #include "ash/shell_factory.h" | 13 #include "ash/shell_factory.h" |
14 #include "ash/shell_window_ids.h" | 14 #include "ash/shell_window_ids.h" |
15 #include "ash/wm/root_window_layout_manager.h" | 15 #include "ash/wm/root_window_layout_manager.h" |
16 #include "base/bind.h" | 16 #include "base/bind.h" |
17 #include "base/logging.h" | 17 #include "base/logging.h" |
18 #include "base/synchronization/cancellation_flag.h" | 18 #include "base/synchronization/cancellation_flag.h" |
19 #include "base/threading/worker_pool.h" | 19 #include "base/threading/worker_pool.h" |
20 #include "content/public/browser/browser_thread.h" | 20 #include "content/public/browser/browser_thread.h" |
| 21 #include "grit/ash_wallpaper_resources.h" |
21 #include "ui/aura/root_window.h" | 22 #include "ui/aura/root_window.h" |
22 #include "ui/aura/window.h" | 23 #include "ui/aura/window.h" |
23 #include "ui/base/resource/resource_bundle.h" | 24 #include "ui/base/resource/resource_bundle.h" |
24 #include "ui/compositor/layer.h" | 25 #include "ui/compositor/layer.h" |
25 #include "ui/gfx/rect.h" | 26 #include "ui/gfx/rect.h" |
26 #include "ui/gfx/image/image.h" | 27 #include "ui/gfx/image/image.h" |
27 #include "ui/views/widget/widget.h" | 28 #include "ui/views/widget/widget.h" |
28 | 29 |
29 using ash::internal::DesktopBackgroundWidgetController; | 30 using ash::internal::DesktopBackgroundWidgetController; |
30 using ash::internal::kAnimatingDesktopController; | 31 using ash::internal::kAnimatingDesktopController; |
31 using ash::internal::kDesktopController; | 32 using ash::internal::kDesktopController; |
32 using content::BrowserThread; | 33 using content::BrowserThread; |
33 | 34 |
34 namespace ash { | 35 namespace ash { |
35 namespace { | 36 namespace { |
36 | 37 |
37 const SkColor kTransparentColor = SkColorSetARGB(0x00, 0x00, 0x00, 0x00); | 38 const SkColor kTransparentColor = SkColorSetARGB(0x00, 0x00, 0x00, 0x00); |
38 | 39 |
39 internal::RootWindowLayoutManager* GetRootWindowLayoutManager( | 40 internal::RootWindowLayoutManager* GetRootWindowLayoutManager( |
40 aura::RootWindow* root_window) { | 41 aura::RootWindow* root_window) { |
41 return static_cast<internal::RootWindowLayoutManager*>( | 42 return static_cast<internal::RootWindowLayoutManager*>( |
42 root_window->layout_manager()); | 43 root_window->layout_manager()); |
43 } | 44 } |
44 } // namespace | 45 } // namespace |
45 | 46 |
| 47 #if defined(GOOGLE_CHROME_BUILD) |
| 48 const WallpaperInfo kDefaultLargeWallpaper = |
| 49 { IDR_AURA_WALLPAPERS_2_LANDSCAPE8_LARGE, WALLPAPER_LAYOUT_CENTER_CROPPED }; |
| 50 const WallpaperInfo kDefaultSmallWallpaper = |
| 51 { IDR_AURA_WALLPAPERS_2_LANDSCAPE8_SMALL, WALLPAPER_LAYOUT_CENTER }; |
| 52 const WallpaperInfo kGuestLargeWallpaper = |
| 53 { IDR_AURA_WALLPAPERS_2_LANDSCAPE7_LARGE, WALLPAPER_LAYOUT_CENTER_CROPPED }; |
| 54 const WallpaperInfo kGuestSmallWallpaper = |
| 55 { IDR_AURA_WALLPAPERS_2_LANDSCAPE7_SMALL, WALLPAPER_LAYOUT_CENTER }; |
| 56 #else |
| 57 const WallpaperInfo kDefaultLargeWallpaper = |
| 58 { IDR_AURA_WALLPAPERS_5_GRADIENT5_LARGE, WALLPAPER_LAYOUT_TILE }; |
| 59 const WallpaperInfo kDefaultSmallWallpaper = |
| 60 { IDR_AURA_WALLPAPERS_5_GRADIENT5_SMALL, WALLPAPER_LAYOUT_TILE }; |
| 61 const WallpaperInfo kGuestLargeWallpaper = kDefaultLargeWallpaper; |
| 62 const WallpaperInfo kGuestSmallWallpaper = kDefaultSmallWallpaper; |
| 63 #endif |
| 64 |
46 const int kSmallWallpaperMaxWidth = 1366; | 65 const int kSmallWallpaperMaxWidth = 1366; |
47 const int kSmallWallpaperMaxHeight = 800; | 66 const int kSmallWallpaperMaxHeight = 800; |
48 const int kLargeWallpaperMaxWidth = 2560; | 67 const int kLargeWallpaperMaxWidth = 2560; |
49 const int kLargeWallpaperMaxHeight = 1700; | 68 const int kLargeWallpaperMaxHeight = 1700; |
50 | 69 |
51 // Stores the current wallpaper data. | 70 // Stores the current wallpaper data. |
52 struct DesktopBackgroundController::WallpaperData { | 71 struct DesktopBackgroundController::WallpaperData { |
53 WallpaperData(int index, WallpaperResolution resolution) | 72 explicit WallpaperData(const WallpaperInfo& info) |
54 : is_default_wallpaper(true), | 73 : wallpaper_info(info), |
55 wallpaper_index(index), | |
56 wallpaper_layout(GetWallpaperViewInfo(index, resolution).layout), | |
57 wallpaper_image(*(ui::ResourceBundle::GetSharedInstance().GetImageNamed( | 74 wallpaper_image(*(ui::ResourceBundle::GetSharedInstance().GetImageNamed( |
58 GetWallpaperViewInfo(index, resolution).id).ToImageSkia())) { | 75 info.idr).ToImageSkia())) { |
59 } | 76 } |
60 WallpaperData(WallpaperLayout layout, const gfx::ImageSkia& image) | 77 WallpaperData(const WallpaperInfo& info, const gfx::ImageSkia& image) |
61 : is_default_wallpaper(false), | 78 : wallpaper_info(info), |
62 wallpaper_index(-1), | |
63 wallpaper_layout(layout), | |
64 wallpaper_image(image) { | 79 wallpaper_image(image) { |
65 } | 80 } |
66 const bool is_default_wallpaper; | 81 const WallpaperInfo wallpaper_info; |
67 const int wallpaper_index; | |
68 const WallpaperLayout wallpaper_layout; | |
69 const gfx::ImageSkia wallpaper_image; | 82 const gfx::ImageSkia wallpaper_image; |
70 }; | 83 }; |
71 | 84 |
72 // DesktopBackgroundController::WallpaperOperation wraps background wallpaper | 85 // DesktopBackgroundController::WallpaperLoader wraps background wallpaper |
73 // loading. | 86 // loading. |
74 class DesktopBackgroundController::WallpaperOperation | 87 class DesktopBackgroundController::WallpaperLoader |
75 : public base::RefCountedThreadSafe< | 88 : public base::RefCountedThreadSafe< |
76 DesktopBackgroundController::WallpaperOperation> { | 89 DesktopBackgroundController::WallpaperLoader> { |
77 public: | 90 public: |
78 WallpaperOperation(int index, WallpaperResolution resolution) | 91 explicit WallpaperLoader(const WallpaperInfo& info) |
79 : index_(index), | 92 : info_(info) { |
80 resolution_(resolution) { | |
81 } | 93 } |
82 | 94 |
83 static void Run(scoped_refptr<WallpaperOperation> wo) { | 95 static void LoadOnWorkerPoolThread(scoped_refptr<WallpaperLoader> wl) { |
84 wo->LoadingWallpaper(); | 96 DCHECK(!BrowserThread::CurrentlyOn(BrowserThread::UI)); |
85 } | 97 wl->LoadingWallpaper(); |
86 | |
87 void LoadingWallpaper() { | |
88 if (cancel_flag_.IsSet()) | |
89 return; | |
90 wallpaper_data_.reset(new WallpaperData(index_, resolution_)); | |
91 } | 98 } |
92 | 99 |
93 void Cancel() { | 100 void Cancel() { |
94 cancel_flag_.Set(); | 101 cancel_flag_.Set(); |
95 } | 102 } |
96 | 103 |
97 int index() const { | 104 int idr() const { |
98 return index_; | 105 return info_.idr; |
99 } | 106 } |
100 | 107 |
101 WallpaperData* ReleaseWallpaperData() { | 108 WallpaperData* ReleaseWallpaperData() { |
102 return wallpaper_data_.release(); | 109 return wallpaper_data_.release(); |
103 } | 110 } |
104 | 111 |
105 private: | 112 private: |
106 friend class base::RefCountedThreadSafe< | 113 friend class base::RefCountedThreadSafe< |
107 DesktopBackgroundController::WallpaperOperation>; | 114 DesktopBackgroundController::WallpaperLoader>; |
108 | 115 |
109 ~WallpaperOperation() {} | 116 void LoadingWallpaper() { |
| 117 if (cancel_flag_.IsSet()) |
| 118 return; |
| 119 wallpaper_data_.reset(new WallpaperData(info_)); |
| 120 } |
| 121 |
| 122 ~WallpaperLoader() {} |
110 | 123 |
111 base::CancellationFlag cancel_flag_; | 124 base::CancellationFlag cancel_flag_; |
112 | 125 |
113 scoped_ptr<WallpaperData> wallpaper_data_; | 126 scoped_ptr<WallpaperData> wallpaper_data_; |
114 | 127 |
115 const int index_; | 128 const WallpaperInfo info_; |
116 | 129 |
117 const WallpaperResolution resolution_; | 130 DISALLOW_COPY_AND_ASSIGN(WallpaperLoader); |
118 | |
119 DISALLOW_COPY_AND_ASSIGN(WallpaperOperation); | |
120 }; | 131 }; |
121 | 132 |
122 DesktopBackgroundController::DesktopBackgroundController() | 133 DesktopBackgroundController::DesktopBackgroundController() |
123 : locked_(false), | 134 : locked_(false), |
124 desktop_background_mode_(BACKGROUND_SOLID_COLOR), | 135 desktop_background_mode_(BACKGROUND_SOLID_COLOR), |
125 background_color_(kTransparentColor), | 136 background_color_(kTransparentColor), |
126 weak_ptr_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) { | 137 weak_ptr_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) { |
127 } | 138 } |
128 | 139 |
129 DesktopBackgroundController::~DesktopBackgroundController() { | 140 DesktopBackgroundController::~DesktopBackgroundController() { |
(...skipping 11 matching lines...) Expand all Loading... |
141 observers_.AddObserver(observer); | 152 observers_.AddObserver(observer); |
142 } | 153 } |
143 | 154 |
144 void DesktopBackgroundController::RemoveObserver( | 155 void DesktopBackgroundController::RemoveObserver( |
145 DesktopBackgroundControllerObserver* observer) { | 156 DesktopBackgroundControllerObserver* observer) { |
146 observers_.RemoveObserver(observer); | 157 observers_.RemoveObserver(observer); |
147 } | 158 } |
148 | 159 |
149 WallpaperLayout DesktopBackgroundController::GetWallpaperLayout() const { | 160 WallpaperLayout DesktopBackgroundController::GetWallpaperLayout() const { |
150 if (current_wallpaper_.get()) | 161 if (current_wallpaper_.get()) |
151 return current_wallpaper_->wallpaper_layout; | 162 return current_wallpaper_->wallpaper_info.layout; |
152 return CENTER_CROPPED; | 163 return WALLPAPER_LAYOUT_CENTER_CROPPED; |
153 } | 164 } |
154 | 165 |
155 gfx::ImageSkia DesktopBackgroundController::GetCurrentWallpaperImage() { | 166 gfx::ImageSkia DesktopBackgroundController::GetCurrentWallpaperImage() { |
156 if (desktop_background_mode_ != BACKGROUND_IMAGE) | 167 if (desktop_background_mode_ != BACKGROUND_IMAGE) |
157 return gfx::ImageSkia(); | 168 return gfx::ImageSkia(); |
158 return GetWallpaper(); | 169 return GetWallpaper(); |
159 } | 170 } |
160 | 171 |
| 172 int DesktopBackgroundController::GetWallpaperIDR() const { |
| 173 if (wallpaper_loader_.get()) |
| 174 return wallpaper_loader_->idr(); |
| 175 else if (current_wallpaper_.get()) |
| 176 return current_wallpaper_->wallpaper_info.idr; |
| 177 else |
| 178 return -1; |
| 179 } |
| 180 |
161 void DesktopBackgroundController::OnRootWindowAdded( | 181 void DesktopBackgroundController::OnRootWindowAdded( |
162 aura::RootWindow* root_window) { | 182 aura::RootWindow* root_window) { |
163 // Handle resolution change for "built-in" images." | 183 // Handle resolution change for "built-in" images." |
164 if (BACKGROUND_IMAGE == desktop_background_mode_ && | 184 if (BACKGROUND_IMAGE == desktop_background_mode_ && |
165 current_wallpaper_.get()) { | 185 current_wallpaper_.get()) { |
166 gfx::Size root_window_size = root_window->GetHostSize(); | 186 gfx::Size root_window_size = root_window->GetHostSize(); |
167 // Loads a higher resolution wallpaper if new root window is larger than | 187 // Loads a higher resolution wallpaper if new root window is larger than |
168 // small screen. | 188 // small screen. |
169 if (kSmallWallpaperMaxWidth < root_window_size.width() || | 189 if (kSmallWallpaperMaxWidth < root_window_size.width() || |
170 kSmallWallpaperMaxHeight < root_window_size.height()) { | 190 kSmallWallpaperMaxHeight < root_window_size.height()) { |
171 if (current_wallpaper_->is_default_wallpaper) { | 191 current_wallpaper_.reset(NULL); |
172 ReloadDefaultWallpaper(); | 192 ash::Shell::GetInstance()->user_wallpaper_delegate()-> |
173 } else { | 193 UpdateWallpaper(); |
174 ash::Shell::GetInstance()->user_wallpaper_delegate()-> | |
175 UpdateWallpaper(); | |
176 } | |
177 } | 194 } |
178 } | 195 } |
179 | 196 |
180 InstallDesktopController(root_window); | 197 InstallDesktopController(root_window); |
181 } | 198 } |
182 | 199 |
183 void DesktopBackgroundController::CacheDefaultWallpaper(int index) { | 200 void DesktopBackgroundController::SetDefaultWallpaper( |
184 DCHECK(index >= 0); | 201 const WallpaperInfo& info) { |
185 | 202 DCHECK_NE(GetWallpaperIDR(), info.idr); |
186 WallpaperResolution resolution = GetAppropriateResolution(); | |
187 scoped_refptr<WallpaperOperation> wallpaper_op = | |
188 new WallpaperOperation(index, resolution); | |
189 base::WorkerPool::PostTask( | |
190 FROM_HERE, | |
191 base::Bind(&WallpaperOperation::Run, wallpaper_op), | |
192 true); | |
193 } | |
194 | |
195 void DesktopBackgroundController::SetDefaultWallpaper(int index) { | |
196 // We should not change background when index is invalid. For instance, at | |
197 // login screen or stub_user login. | |
198 if (index == GetInvalidWallpaperIndex()) { | |
199 CreateEmptyWallpaper(); | |
200 return; | |
201 } else if (index == GetSolidColorIndex()) { | |
202 SetDesktopBackgroundSolidColorMode(kLoginWallpaperColor); | |
203 return; | |
204 } | |
205 | |
206 // Prevents loading of the same wallpaper as the currently loading/loaded | |
207 // one. | |
208 if ((wallpaper_op_.get() && wallpaper_op_->index() == index) || | |
209 (current_wallpaper_.get() && | |
210 current_wallpaper_->wallpaper_index == index)) { | |
211 return; | |
212 } | |
213 | 203 |
214 CancelPendingWallpaperOperation(); | 204 CancelPendingWallpaperOperation(); |
215 | 205 wallpaper_loader_ = new WallpaperLoader(info); |
216 WallpaperResolution resolution = GetAppropriateResolution(); | |
217 | |
218 wallpaper_op_ = new WallpaperOperation(index, resolution); | |
219 base::WorkerPool::PostTaskAndReply( | 206 base::WorkerPool::PostTaskAndReply( |
220 FROM_HERE, | 207 FROM_HERE, |
221 base::Bind(&WallpaperOperation::Run, wallpaper_op_), | 208 base::Bind(&WallpaperLoader::LoadOnWorkerPoolThread, wallpaper_loader_), |
222 base::Bind(&DesktopBackgroundController::OnWallpaperLoadCompleted, | 209 base::Bind(&DesktopBackgroundController::OnWallpaperLoadCompleted, |
223 weak_ptr_factory_.GetWeakPtr(), | 210 weak_ptr_factory_.GetWeakPtr(), |
224 wallpaper_op_), | 211 wallpaper_loader_), |
225 true /* task_is_slow */); | 212 true /* task_is_slow */); |
226 } | 213 } |
227 | 214 |
228 void DesktopBackgroundController::ReloadDefaultWallpaper() { | |
229 int index = current_wallpaper_->wallpaper_index; | |
230 current_wallpaper_.reset(NULL); | |
231 SetDefaultWallpaper(index); | |
232 } | |
233 | |
234 void DesktopBackgroundController::SetCustomWallpaper( | 215 void DesktopBackgroundController::SetCustomWallpaper( |
235 const gfx::ImageSkia& wallpaper, | 216 const gfx::ImageSkia& wallpaper, |
236 WallpaperLayout layout) { | 217 WallpaperLayout layout) { |
237 CancelPendingWallpaperOperation(); | 218 CancelPendingWallpaperOperation(); |
238 if (current_wallpaper_.get() && | 219 if (current_wallpaper_.get() && |
239 current_wallpaper_->wallpaper_image.BackedBySameObjectAs(wallpaper)) { | 220 current_wallpaper_->wallpaper_image.BackedBySameObjectAs(wallpaper)) { |
240 return; | 221 return; |
241 } | 222 } |
242 | 223 |
243 current_wallpaper_.reset(new WallpaperData(layout, wallpaper)); | 224 WallpaperInfo info = { -1, layout }; |
| 225 current_wallpaper_.reset(new WallpaperData(info, wallpaper)); |
244 FOR_EACH_OBSERVER(DesktopBackgroundControllerObserver, observers_, | 226 FOR_EACH_OBSERVER(DesktopBackgroundControllerObserver, observers_, |
245 OnWallpaperDataChanged()); | 227 OnWallpaperDataChanged()); |
246 SetDesktopBackgroundImageMode(); | 228 SetDesktopBackgroundImageMode(); |
247 } | 229 } |
248 | 230 |
249 void DesktopBackgroundController::CancelPendingWallpaperOperation() { | 231 void DesktopBackgroundController::CancelPendingWallpaperOperation() { |
250 // Set canceled flag of previous request to skip unneeded loading. | 232 // Set canceled flag of previous request to skip unneeded loading. |
251 if (wallpaper_op_.get()) | 233 if (wallpaper_loader_.get()) |
252 wallpaper_op_->Cancel(); | 234 wallpaper_loader_->Cancel(); |
253 | 235 |
254 // Cancel reply callback for previous request. | 236 // Cancel reply callback for previous request. |
255 weak_ptr_factory_.InvalidateWeakPtrs(); | 237 weak_ptr_factory_.InvalidateWeakPtrs(); |
256 } | 238 } |
257 | 239 |
258 void DesktopBackgroundController::SetDesktopBackgroundSolidColorMode( | 240 void DesktopBackgroundController::SetDesktopBackgroundSolidColorMode( |
259 SkColor color) { | 241 SkColor color) { |
260 background_color_ = color; | 242 background_color_ = color; |
261 desktop_background_mode_ = BACKGROUND_SOLID_COLOR; | 243 desktop_background_mode_ = BACKGROUND_SOLID_COLOR; |
262 | 244 |
263 InstallDesktopControllerForAllWindows(); | 245 InstallDesktopControllerForAllWindows(); |
264 } | 246 } |
265 | 247 |
266 void DesktopBackgroundController::CreateEmptyWallpaper() { | 248 void DesktopBackgroundController::CreateEmptyWallpaper() { |
267 current_wallpaper_.reset(NULL); | 249 current_wallpaper_.reset(NULL); |
268 SetDesktopBackgroundImageMode(); | 250 SetDesktopBackgroundImageMode(); |
269 } | 251 } |
270 | 252 |
271 WallpaperResolution DesktopBackgroundController::GetAppropriateResolution() { | 253 WallpaperResolution DesktopBackgroundController::GetAppropriateResolution() { |
272 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); | 254 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); |
273 WallpaperResolution resolution = SMALL; | 255 WallpaperResolution resolution = WALLPAPER_RESOLUTION_SMALL; |
274 Shell::RootWindowList root_windows = Shell::GetAllRootWindows(); | 256 Shell::RootWindowList root_windows = Shell::GetAllRootWindows(); |
275 for (Shell::RootWindowList::iterator iter = root_windows.begin(); | 257 for (Shell::RootWindowList::iterator iter = root_windows.begin(); |
276 iter != root_windows.end(); ++iter) { | 258 iter != root_windows.end(); ++iter) { |
277 gfx::Size root_window_size = (*iter)->GetHostSize(); | 259 gfx::Size root_window_size = (*iter)->GetHostSize(); |
278 if (root_window_size.width() > kSmallWallpaperMaxWidth || | 260 if (root_window_size.width() > kSmallWallpaperMaxWidth || |
279 root_window_size.height() > kSmallWallpaperMaxHeight) { | 261 root_window_size.height() > kSmallWallpaperMaxHeight) { |
280 resolution = LARGE; | 262 resolution = WALLPAPER_RESOLUTION_LARGE; |
281 } | 263 } |
282 } | 264 } |
283 return resolution; | 265 return resolution; |
284 } | 266 } |
285 | 267 |
286 bool DesktopBackgroundController::MoveDesktopToLockedContainer() { | 268 bool DesktopBackgroundController::MoveDesktopToLockedContainer() { |
287 if (locked_) | 269 if (locked_) |
288 return false; | 270 return false; |
289 locked_ = true; | 271 locked_ = true; |
290 return ReparentBackgroundWidgets(GetBackgroundContainerId(false), | 272 return ReparentBackgroundWidgets(GetBackgroundContainerId(false), |
(...skipping 14 matching lines...) Expand all Loading... |
305 window->SetProperty(kAnimatingDesktopController, | 287 window->SetProperty(kAnimatingDesktopController, |
306 static_cast<internal::AnimatingDesktopController*>(NULL)); | 288 static_cast<internal::AnimatingDesktopController*>(NULL)); |
307 } | 289 } |
308 | 290 |
309 void DesktopBackgroundController::SetDesktopBackgroundImageMode() { | 291 void DesktopBackgroundController::SetDesktopBackgroundImageMode() { |
310 desktop_background_mode_ = BACKGROUND_IMAGE; | 292 desktop_background_mode_ = BACKGROUND_IMAGE; |
311 InstallDesktopControllerForAllWindows(); | 293 InstallDesktopControllerForAllWindows(); |
312 } | 294 } |
313 | 295 |
314 void DesktopBackgroundController::OnWallpaperLoadCompleted( | 296 void DesktopBackgroundController::OnWallpaperLoadCompleted( |
315 scoped_refptr<WallpaperOperation> wo) { | 297 scoped_refptr<WallpaperLoader> wl) { |
316 current_wallpaper_.reset(wo->ReleaseWallpaperData()); | 298 current_wallpaper_.reset(wl->ReleaseWallpaperData()); |
317 FOR_EACH_OBSERVER(DesktopBackgroundControllerObserver, observers_, | 299 FOR_EACH_OBSERVER(DesktopBackgroundControllerObserver, observers_, |
318 OnWallpaperDataChanged()); | 300 OnWallpaperDataChanged()); |
319 | 301 |
320 SetDesktopBackgroundImageMode(); | 302 SetDesktopBackgroundImageMode(); |
321 | 303 |
322 DCHECK(wo.get() == wallpaper_op_.get()); | 304 DCHECK(wl.get() == wallpaper_loader_.get()); |
323 wallpaper_op_ = NULL; | 305 wallpaper_loader_ = NULL; |
324 } | 306 } |
325 | 307 |
326 void DesktopBackgroundController::NotifyAnimationFinished() { | 308 void DesktopBackgroundController::NotifyAnimationFinished() { |
327 Shell* shell = Shell::GetInstance(); | 309 Shell* shell = Shell::GetInstance(); |
328 shell->GetPrimaryRootWindowController()->HandleDesktopBackgroundVisible(); | 310 shell->GetPrimaryRootWindowController()->HandleDesktopBackgroundVisible(); |
329 shell->user_wallpaper_delegate()->OnWallpaperAnimationFinished(); | 311 shell->user_wallpaper_delegate()->OnWallpaperAnimationFinished(); |
330 } | 312 } |
331 | 313 |
332 ui::Layer* DesktopBackgroundController::SetColorLayerForContainer( | 314 ui::Layer* DesktopBackgroundController::SetColorLayerForContainer( |
333 SkColor color, | 315 SkColor color, |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
424 } | 406 } |
425 return moved; | 407 return moved; |
426 } | 408 } |
427 | 409 |
428 int DesktopBackgroundController::GetBackgroundContainerId(bool locked) { | 410 int DesktopBackgroundController::GetBackgroundContainerId(bool locked) { |
429 return locked ? internal::kShellWindowId_LockScreenBackgroundContainer : | 411 return locked ? internal::kShellWindowId_LockScreenBackgroundContainer : |
430 internal::kShellWindowId_DesktopBackgroundContainer; | 412 internal::kShellWindowId_DesktopBackgroundContainer; |
431 } | 413 } |
432 | 414 |
433 } // namespace ash | 415 } // namespace ash |
OLD | NEW |