system_background_controller.h revision 7d4cd473f85ac64c3747c96c277f9e506a0d2246
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. 4 5#ifndef ASH_WM_SYSTEM_BACKGROUND_CONTROLLER_H_ 6#define ASH_WM_SYSTEM_BACKGROUND_CONTROLLER_H_ 7 8#include <string> 9 10#include "ash/ash_export.h" 11#include "base/basictypes.h" 12#include "base/memory/scoped_ptr.h" 13#include "third_party/skia/include/core/SkColor.h" 14#include "ui/aura/window_observer.h" 15 16namespace aura { 17class RootWindow; 18} 19 20namespace ui { 21class Layer; 22} 23 24namespace ash { 25namespace internal { 26 27// SystemBackgroundController manages a ui::Layer that's stacked at the bottom 28// of an aura::RootWindow's children. It exists solely to obscure portions of 29// the root layer that aren't covered by any other layers (e.g. before the 30// desktop background image is loaded at startup, or when we scale down all of 31// the other layers as part of a power-button or window-management animation). 32// It should never be transformed or restacked. 33class SystemBackgroundController : public aura::WindowObserver { 34 public: 35 SystemBackgroundController(aura::RootWindow* root_window, SkColor color); 36 virtual ~SystemBackgroundController(); 37 38 void SetColor(SkColor color); 39 40 // aura::WindowObserver overrides: 41 virtual void OnWindowBoundsChanged(aura::Window* root, 42 const gfx::Rect& old_bounds, 43 const gfx::Rect& new_bounds) OVERRIDE; 44 45 private: 46 class HostContentLayerDelegate; 47 48 aura::RootWindow* root_window_; // not owned 49 50 scoped_ptr<ui::Layer> layer_; 51 52 DISALLOW_COPY_AND_ASSIGN(SystemBackgroundController); 53}; 54 55} // namespace internal 56} // namespace ash 57 58#endif // ASH_WM_SYSTEM_BACKGROUND_CONTROLLER_H_ 59