| 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/wm/system_background_controller.h" | 5 #include "ash/wm/system_wallpaper_controller.h" |
| 6 | 6 |
| 7 #include "ui/aura/window.h" | 7 #include "ui/aura/window.h" |
| 8 #include "ui/compositor/layer.h" | 8 #include "ui/compositor/layer.h" |
| 9 #include "ui/compositor/layer_type.h" | 9 #include "ui/compositor/layer_type.h" |
| 10 | 10 |
| 11 namespace ash { | 11 namespace ash { |
| 12 | 12 |
| 13 SystemBackgroundController::SystemBackgroundController( | 13 SystemWallpaperController::SystemWallpaperController(aura::Window* root_window, |
| 14 aura::Window* root_window, | 14 SkColor color) |
| 15 SkColor color) | |
| 16 : root_window_(root_window), layer_(new ui::Layer(ui::LAYER_SOLID_COLOR)) { | 15 : root_window_(root_window), layer_(new ui::Layer(ui::LAYER_SOLID_COLOR)) { |
| 17 root_window_->AddObserver(this); | 16 root_window_->AddObserver(this); |
| 18 layer_->SetColor(color); | 17 layer_->SetColor(color); |
| 19 | 18 |
| 20 ui::Layer* root_layer = root_window_->layer(); | 19 ui::Layer* root_layer = root_window_->layer(); |
| 21 layer_->SetBounds(gfx::Rect(root_layer->bounds().size())); | 20 layer_->SetBounds(gfx::Rect(root_layer->bounds().size())); |
| 22 root_layer->Add(layer_.get()); | 21 root_layer->Add(layer_.get()); |
| 23 root_layer->StackAtBottom(layer_.get()); | 22 root_layer->StackAtBottom(layer_.get()); |
| 24 } | 23 } |
| 25 | 24 |
| 26 SystemBackgroundController::~SystemBackgroundController() { | 25 SystemWallpaperController::~SystemWallpaperController() { |
| 27 root_window_->RemoveObserver(this); | 26 root_window_->RemoveObserver(this); |
| 28 } | 27 } |
| 29 | 28 |
| 30 void SystemBackgroundController::SetColor(SkColor color) { | 29 void SystemWallpaperController::SetColor(SkColor color) { |
| 31 layer_->SetColor(color); | 30 layer_->SetColor(color); |
| 32 } | 31 } |
| 33 | 32 |
| 34 void SystemBackgroundController::OnWindowBoundsChanged( | 33 void SystemWallpaperController::OnWindowBoundsChanged( |
| 35 aura::Window* root, | 34 aura::Window* root, |
| 36 const gfx::Rect& old_bounds, | 35 const gfx::Rect& old_bounds, |
| 37 const gfx::Rect& new_bounds) { | 36 const gfx::Rect& new_bounds) { |
| 38 DCHECK_EQ(root_window_, root); | 37 DCHECK_EQ(root_window_, root); |
| 39 layer_->SetBounds(gfx::Rect(root_window_->layer()->bounds().size())); | 38 layer_->SetBounds(gfx::Rect(root_window_->layer()->bounds().size())); |
| 40 } | 39 } |
| 41 | 40 |
| 42 } // namespace ash | 41 } // namespace ash |
| OLD | NEW |