Chromium Code Reviews| 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 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 132 } | 132 } |
| 133 | 133 |
| 134 void DesktopBackgroundController::SetLoggedInUserWallpaper() { | 134 void DesktopBackgroundController::SetLoggedInUserWallpaper() { |
| 135 int index = Shell::GetInstance()->user_wallpaper_delegate()-> | 135 int index = Shell::GetInstance()->user_wallpaper_delegate()-> |
| 136 GetUserWallpaperIndex(); | 136 GetUserWallpaperIndex(); |
| 137 // We should not change background when index is invalid. For instance, at | 137 // We should not change background when index is invalid. For instance, at |
| 138 // login screen or stub_user login. | 138 // login screen or stub_user login. |
| 139 if (index == ash::GetInvalidWallpaperIndex()) { | 139 if (index == ash::GetInvalidWallpaperIndex()) { |
| 140 CreateEmptyWallpaper(); | 140 CreateEmptyWallpaper(); |
| 141 return; | 141 return; |
| 142 } else if (index == ash::GetSolidColorIndex()) { | |
|
Nikita (slow)
2012/06/04 18:23:03
I'm a bit confused why this happens inside SetLogg
bshe
2012/06/08 15:06:30
It is also used when user toggle background color
| |
| 143 SetDesktopBackgroundSolidColorMode(); | |
| 144 return; | |
| 142 } | 145 } |
| 143 | 146 |
| 144 SetDefaultWallpaper(index); | 147 SetDefaultWallpaper(index); |
| 145 } | 148 } |
| 146 | 149 |
| 147 void DesktopBackgroundController::SetDesktopBackgroundSolidColorMode() { | 150 void DesktopBackgroundController::SetDesktopBackgroundSolidColorMode() { |
| 148 // Set a solid black background. | 151 // Set a solid black background. |
| 149 // TODO(derat): Remove this in favor of having the compositor only clear the | 152 // TODO(derat): Remove this in favor of having the compositor only clear the |
| 150 // viewport when there are regions not covered by a layer: | 153 // viewport when there are regions not covered by a layer: |
| 151 // http://crbug.com/113445 | 154 // http://crbug.com/113445 |
| 152 ui::Layer* background_layer = new ui::Layer(ui::LAYER_SOLID_COLOR); | 155 ui::Layer* background_layer = new ui::Layer(ui::LAYER_SOLID_COLOR); |
| 153 background_layer->SetColor(SK_ColorBLACK); | 156 background_layer->SetColor(SK_ColorWallpaperGray); |
|
Nikita (slow)
2012/06/04 18:23:03
I think that it makes sense to pass color as a par
bshe
2012/06/08 15:06:30
Done.
| |
| 154 root_window_->GetChildById( | 157 root_window_->GetChildById( |
| 155 internal::kShellWindowId_DesktopBackgroundContainer)-> | 158 internal::kShellWindowId_DesktopBackgroundContainer)-> |
| 156 layer()->Add(background_layer); | 159 layer()->Add(background_layer); |
| 157 GetRootWindowLayoutManager(root_window_)->SetBackgroundLayer( | 160 GetRootWindowLayoutManager(root_window_)->SetBackgroundLayer( |
| 158 background_layer); | 161 background_layer); |
| 159 GetRootWindowLayoutManager(root_window_)->SetBackgroundWidget(NULL); | 162 GetRootWindowLayoutManager(root_window_)->SetBackgroundWidget(NULL); |
| 160 desktop_background_mode_ = BACKGROUND_SOLID_COLOR; | 163 desktop_background_mode_ = BACKGROUND_SOLID_COLOR; |
| 161 } | 164 } |
| 162 | 165 |
| 163 void DesktopBackgroundController::SetDesktopBackgroundImageMode( | 166 void DesktopBackgroundController::SetDesktopBackgroundImageMode( |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 179 wallpaper_op_ = NULL; | 182 wallpaper_op_ = NULL; |
| 180 } | 183 } |
| 181 | 184 |
| 182 void DesktopBackgroundController::CreateEmptyWallpaper() { | 185 void DesktopBackgroundController::CreateEmptyWallpaper() { |
| 183 gfx::ImageSkia dummy; | 186 gfx::ImageSkia dummy; |
| 184 internal::CreateDesktopBackground(dummy, CENTER, root_window_); | 187 internal::CreateDesktopBackground(dummy, CENTER, root_window_); |
| 185 desktop_background_mode_ = BACKGROUND_IMAGE; | 188 desktop_background_mode_ = BACKGROUND_IMAGE; |
| 186 } | 189 } |
| 187 | 190 |
| 188 } // namespace ash | 191 } // namespace ash |
| OLD | NEW |