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 11 matching lines...) Expand all Loading... |
22 DesktopBackgroundController::DesktopBackgroundController() : | 22 DesktopBackgroundController::DesktopBackgroundController() : |
23 desktop_background_mode_(BACKGROUND_IMAGE) { | 23 desktop_background_mode_(BACKGROUND_IMAGE) { |
24 } | 24 } |
25 | 25 |
26 DesktopBackgroundController::~DesktopBackgroundController() { | 26 DesktopBackgroundController::~DesktopBackgroundController() { |
27 } | 27 } |
28 | 28 |
29 void DesktopBackgroundController::SetDesktopBackgroundImageMode() { | 29 void DesktopBackgroundController::SetDesktopBackgroundImageMode() { |
30 internal::RootWindowLayoutManager* root_window_layout = | 30 internal::RootWindowLayoutManager* root_window_layout = |
31 Shell::GetInstance()->root_window_layout(); | 31 Shell::GetInstance()->root_window_layout(); |
32 if (root_window_layout->background_widget()) | |
33 root_window_layout->background_widget()->Hide(); | |
34 int index = Shell::GetInstance()->user_wallpaper_delegate()-> | 32 int index = Shell::GetInstance()->user_wallpaper_delegate()-> |
35 GetUserWallpaperIndex(); | 33 GetUserWallpaperIndex(); |
36 root_window_layout->SetBackgroundLayer(NULL); | 34 root_window_layout->SetBackgroundLayer(NULL); |
37 root_window_layout->SetBackgroundWidget( | 35 internal::CreateDesktopBackground(GetWallpaper(index), |
38 internal::CreateDesktopBackground(GetWallpaper(index), | 36 GetWallpaperInfo(index).layout); |
39 GetWallpaperInfo(index).layout)); | |
40 desktop_background_mode_ = BACKGROUND_IMAGE; | 37 desktop_background_mode_ = BACKGROUND_IMAGE; |
41 } | 38 } |
42 | 39 |
43 void DesktopBackgroundController::SetDesktopBackgroundSolidColorMode() { | 40 void DesktopBackgroundController::SetDesktopBackgroundSolidColorMode() { |
44 // Set a solid black background. | 41 // Set a solid black background. |
45 // TODO(derat): Remove this in favor of having the compositor only clear the | 42 // TODO(derat): Remove this in favor of having the compositor only clear the |
46 // viewport when there are regions not covered by a layer: | 43 // viewport when there are regions not covered by a layer: |
47 // http://crbug.com/113445 | 44 // http://crbug.com/113445 |
48 Shell* shell = Shell::GetInstance(); | 45 Shell* shell = Shell::GetInstance(); |
49 ui::Layer* background_layer = new ui::Layer(ui::LAYER_SOLID_COLOR); | 46 ui::Layer* background_layer = new ui::Layer(ui::LAYER_SOLID_COLOR); |
50 background_layer->SetColor(SK_ColorBLACK); | 47 background_layer->SetColor(SK_ColorBLACK); |
51 shell->GetContainer(internal::kShellWindowId_DesktopBackgroundContainer)-> | 48 shell->GetContainer(internal::kShellWindowId_DesktopBackgroundContainer)-> |
52 layer()->Add(background_layer); | 49 layer()->Add(background_layer); |
53 shell->root_window_layout()->SetBackgroundLayer(background_layer); | 50 shell->root_window_layout()->SetBackgroundLayer(background_layer); |
54 shell->root_window_layout()->SetBackgroundWidget(NULL); | 51 shell->root_window_layout()->SetBackgroundWidget(NULL); |
55 desktop_background_mode_ = BACKGROUND_SOLID_COLOR; | 52 desktop_background_mode_ = BACKGROUND_SOLID_COLOR; |
56 } | 53 } |
57 | 54 |
58 } // namespace ash | 55 } // namespace ash |
OLD | NEW |