Mailbox support for texture layers.
[chromium-blink-merge.git] / ash / wm / system_background_controller.cc
blob8f06f02e7c1e8928329cbe6fb4af4ac7bc3f8c09
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
3 // found in the LICENSE file.
5 #include "ash/wm/system_background_controller.h"
7 #include "ui/aura/root_window.h"
8 #include "ui/compositor/layer.h"
9 #include "ui/compositor/layer_type.h"
11 namespace ash {
12 namespace internal {
14 namespace {
16 #if defined(OS_CHROMEOS)
17 // Background color used for the Chrome OS boot splash screen.
18 const SkColor kChromeOsBootColor = SkColorSetARGB(0xff, 0xfe, 0xfe, 0xfe);
19 #endif
21 } // namespace
23 SystemBackgroundController::SystemBackgroundController(
24 aura::RootWindow* root_window,
25 SkColor color)
26 : root_window_(root_window),
27 layer_(new ui::Layer(ui::LAYER_SOLID_COLOR)) {
28 root_window_->AddRootWindowObserver(this);
29 layer_->SetColor(color);
31 ui::Layer* root_layer = root_window_->layer();
32 layer_->SetBounds(gfx::Rect(root_layer->bounds().size()));
33 root_layer->Add(layer_.get());
34 root_layer->StackAtBottom(layer_.get());
37 SystemBackgroundController::~SystemBackgroundController() {
38 root_window_->RemoveRootWindowObserver(this);
41 void SystemBackgroundController::SetColor(SkColor color) {
42 layer_->SetColor(color);
45 void SystemBackgroundController::OnRootWindowResized(
46 const aura::RootWindow* root,
47 const gfx::Size& old_size) {
48 DCHECK_EQ(root_window_, root);
49 layer_->SetBounds(gfx::Rect(root_window_->layer()->bounds().size()));
52 } // namespace internal
53 } // namespace ash