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_view.h" | 7 #include "ash/desktop_background/desktop_background_view.h" |
8 #include "ash/shell.h" | 8 #include "ash/shell.h" |
9 #include "ash/shell_factory.h" | 9 #include "ash/shell_factory.h" |
10 #include "ash/shell_window_ids.h" | 10 #include "ash/shell_window_ids.h" |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
127 } else { | 127 } else { |
128 internal::CreateDesktopBackground(root_window); | 128 internal::CreateDesktopBackground(root_window); |
129 } | 129 } |
130 break; | 130 break; |
131 case BACKGROUND_SOLID_COLOR: | 131 case BACKGROUND_SOLID_COLOR: |
132 SetDesktopBackgroundSolidColorMode(background_color_); | 132 SetDesktopBackgroundSolidColorMode(background_color_); |
133 break; | 133 break; |
134 } | 134 } |
135 } | 135 } |
136 | 136 |
137 void DesktopBackgroundController::TriggerCacheDefaultWallpaper(int index) { | |
138 if (index == ash::GetInvalidWallpaperIndex() || | |
Nikita (slow)
2012/08/06 16:36:01
just check for index < 0 ?
bshe
2012/08/07 15:18:57
I was trying to avoid magic number like 0. But i a
| |
139 index == ash::GetSolidColorIndex()) | |
140 return; | |
141 scoped_refptr<WallpaperOperation> wallpaper_op = | |
142 new WallpaperOperation(index); | |
143 base::WorkerPool::PostTask( | |
144 FROM_HERE, | |
145 base::Bind(&WallpaperOperation::Run, wallpaper_op), | |
146 true); | |
147 } | |
148 | |
137 void DesktopBackgroundController::SetDefaultWallpaper(int index) { | 149 void DesktopBackgroundController::SetDefaultWallpaper(int index) { |
138 // We should not change background when index is invalid. For instance, at | 150 // We should not change background when index is invalid. For instance, at |
139 // login screen or stub_user login. | 151 // login screen or stub_user login. |
140 if (index == ash::GetInvalidWallpaperIndex()) { | 152 if (index == ash::GetInvalidWallpaperIndex()) { |
141 CreateEmptyWallpaper(); | 153 CreateEmptyWallpaper(); |
142 return; | 154 return; |
143 } else if (index == ash::GetSolidColorIndex()) { | 155 } else if (index == ash::GetSolidColorIndex()) { |
144 SetDesktopBackgroundSolidColorMode(kLoginWallpaperColor); | 156 SetDesktopBackgroundSolidColorMode(kLoginWallpaperColor); |
145 return; | 157 return; |
146 } | 158 } |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
235 current_wallpaper_.reset(NULL); | 247 current_wallpaper_.reset(NULL); |
236 desktop_background_mode_ = BACKGROUND_IMAGE; | 248 desktop_background_mode_ = BACKGROUND_IMAGE; |
237 Shell::RootWindowList root_windows = Shell::GetAllRootWindows(); | 249 Shell::RootWindowList root_windows = Shell::GetAllRootWindows(); |
238 for (Shell::RootWindowList::iterator iter = root_windows.begin(); | 250 for (Shell::RootWindowList::iterator iter = root_windows.begin(); |
239 iter != root_windows.end(); ++iter) { | 251 iter != root_windows.end(); ++iter) { |
240 internal::CreateDesktopBackground(*iter); | 252 internal::CreateDesktopBackground(*iter); |
241 } | 253 } |
242 } | 254 } |
243 | 255 |
244 } // namespace ash | 256 } // namespace ash |
OLD | NEW |