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 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
143 | 143 |
144 SetDefaultWallpaper(index); | 144 SetDefaultWallpaper(index); |
145 } | 145 } |
146 | 146 |
147 void DesktopBackgroundController::SetDesktopBackgroundSolidColorMode() { | 147 void DesktopBackgroundController::SetDesktopBackgroundSolidColorMode() { |
148 // Set a solid black background. | 148 // Set a solid black background. |
149 // TODO(derat): Remove this in favor of having the compositor only clear the | 149 // TODO(derat): Remove this in favor of having the compositor only clear the |
150 // viewport when there are regions not covered by a layer: | 150 // viewport when there are regions not covered by a layer: |
151 // http://crbug.com/113445 | 151 // http://crbug.com/113445 |
152 ui::Layer* background_layer = new ui::Layer(ui::LAYER_SOLID_COLOR); | 152 ui::Layer* background_layer = new ui::Layer(ui::LAYER_SOLID_COLOR); |
153 background_layer->SetColor(SK_ColorBLACK); | 153 background_layer->SetColor(SK_ColorWallpaperGray); |
Nikita (slow)
2012/06/04 11:23:04
I'm not sure whether this affects other code paths
bshe
2012/06/04 13:46:22
I think we dont use the solid color background at
| |
154 root_window_->GetChildById( | 154 root_window_->GetChildById( |
155 internal::kShellWindowId_DesktopBackgroundContainer)-> | 155 internal::kShellWindowId_DesktopBackgroundContainer)-> |
156 layer()->Add(background_layer); | 156 layer()->Add(background_layer); |
157 GetRootWindowLayoutManager(root_window_)->SetBackgroundLayer( | 157 GetRootWindowLayoutManager(root_window_)->SetBackgroundLayer( |
158 background_layer); | 158 background_layer); |
159 GetRootWindowLayoutManager(root_window_)->SetBackgroundWidget(NULL); | 159 GetRootWindowLayoutManager(root_window_)->SetBackgroundWidget(NULL); |
160 desktop_background_mode_ = BACKGROUND_SOLID_COLOR; | 160 desktop_background_mode_ = BACKGROUND_SOLID_COLOR; |
161 } | 161 } |
162 | 162 |
163 void DesktopBackgroundController::SetDesktopBackgroundImageMode( | 163 void DesktopBackgroundController::SetDesktopBackgroundImageMode( |
164 scoped_refptr<WallpaperOperation> wo) { | 164 scoped_refptr<WallpaperOperation> wo) { |
165 GetRootWindowLayoutManager(root_window_)->SetBackgroundLayer(NULL); | 165 GetRootWindowLayoutManager(root_window_)->SetBackgroundLayer(NULL); |
166 if(wo->wallpaper()) { | 166 if(wo->wallpaper()) { |
167 internal::CreateDesktopBackground( | 167 internal::CreateDesktopBackground( |
168 *wo->wallpaper(), wo->wallpaper_layout(), root_window_); | 168 *wo->wallpaper(), wo->wallpaper_layout(), root_window_); |
169 desktop_background_mode_ = BACKGROUND_IMAGE; | 169 desktop_background_mode_ = BACKGROUND_IMAGE; |
170 } | 170 } |
171 } | 171 } |
172 | 172 |
173 void DesktopBackgroundController::OnWallpaperLoadCompleted( | 173 void DesktopBackgroundController::OnWallpaperLoadCompleted( |
174 scoped_refptr<WallpaperOperation> wo) { | 174 scoped_refptr<WallpaperOperation> wo) { |
175 SetDesktopBackgroundImageMode(wo); | 175 SetDesktopBackgroundImageMode(wo); |
176 previous_index_ = wo->index(); | 176 previous_index_ = wo->index(); |
177 | 177 |
178 DCHECK(wo.get() == wallpaper_op_.get()); | 178 DCHECK(wo.get() == wallpaper_op_.get()); |
179 wallpaper_op_ = NULL; | 179 wallpaper_op_ = NULL; |
180 } | 180 } |
181 | 181 |
182 void DesktopBackgroundController::CreateEmptyWallpaper() { | 182 void DesktopBackgroundController::CreateEmptyWallpaper() { |
183 gfx::ImageSkia dummy; | 183 SetDesktopBackgroundSolidColorMode(); |
184 internal::CreateDesktopBackground(dummy, CENTER, root_window_); | 184 desktop_background_mode_ = BACKGROUND_SOLID_COLOR; |
185 desktop_background_mode_ = BACKGROUND_IMAGE; | |
186 } | 185 } |
187 | 186 |
188 } // namespace ash | 187 } // namespace ash |
OLD | NEW |