1762bb9d0ad20320b9f97a841dce57ba5e8e48b07Richard Smith// Copyright (c) 2012 The Chromium Authors. All rights reserved.
234b41d939a1328f484511c6002ba2456db879a29Richard Smith// Use of this source code is governed by a BSD-style license that can be
334b41d939a1328f484511c6002ba2456db879a29Richard Smith// found in the LICENSE file.
434b41d939a1328f484511c6002ba2456db879a29Richard Smith
534b41d939a1328f484511c6002ba2456db879a29Richard Smith#ifndef ASH_WM_SYSTEM_BACKGROUND_CONTROLLER_H_
67a614d8380297fcd2bc23986241905d97222948cRichard Smith#define ASH_WM_SYSTEM_BACKGROUND_CONTROLLER_H_
77a614d8380297fcd2bc23986241905d97222948cRichard Smith
87a614d8380297fcd2bc23986241905d97222948cRichard Smith#include <string>
934b41d939a1328f484511c6002ba2456db879a29Richard Smith
1034b41d939a1328f484511c6002ba2456db879a29Richard Smith#include "ash/ash_export.h"
1134b41d939a1328f484511c6002ba2456db879a29Richard Smith#include "base/basictypes.h"
127a614d8380297fcd2bc23986241905d97222948cRichard Smith#include "base/memory/scoped_ptr.h"
1334b41d939a1328f484511c6002ba2456db879a29Richard Smith#include "third_party/skia/include/core/SkColor.h"
1414f78f4a11df4c06667e2cbb87eeb179e4cb46feRichard Smith#include "ui/aura/window_observer.h"
1534b41d939a1328f484511c6002ba2456db879a29Richard Smith
1634b41d939a1328f484511c6002ba2456db879a29Richard Smithnamespace ui {
1724d44eddfc98464d10802e71c77d3dc3e45f4aacRichard Smithclass Layer;
18ddc83f9255834217f0559b09ff75a1c50b8ce457Richard Smith}
19e7397c6a1bb2b205c5fe678e26199eb26d22e38eRichard Smith
20ddc83f9255834217f0559b09ff75a1c50b8ce457Richard Smithnamespace ash {
21ddc83f9255834217f0559b09ff75a1c50b8ce457Richard Smith
2234b41d939a1328f484511c6002ba2456db879a29Richard Smith// SystemBackgroundController manages a ui::Layer that's stacked at the bottom
2334b41d939a1328f484511c6002ba2456db879a29Richard Smith// of an aura::RootWindow's children.  It exists solely to obscure portions of
2434b41d939a1328f484511c6002ba2456db879a29Richard Smith// the root layer that aren't covered by any other layers (e.g. before the
2534b41d939a1328f484511c6002ba2456db879a29Richard Smith// desktop background image is loaded at startup, or when we scale down all of
2634b41d939a1328f484511c6002ba2456db879a29Richard Smith// the other layers as part of a power-button or window-management animation).
2734b41d939a1328f484511c6002ba2456db879a29Richard Smith// It should never be transformed or restacked.
2834b41d939a1328f484511c6002ba2456db879a29Richard Smithclass SystemBackgroundController : public aura::WindowObserver {
2934b41d939a1328f484511c6002ba2456db879a29Richard Smith public:
30e2bb224dee15d07bc9843acd4f3ded8eb0f835edAnders Carlsson  SystemBackgroundController(aura::Window* root_window, SkColor color);
31baf45d31f18e6d5b3d2a33695c2af6e6cbc4ee29Anders Carlsson  virtual ~SystemBackgroundController();
3234b41d939a1328f484511c6002ba2456db879a29Richard Smith
3334b41d939a1328f484511c6002ba2456db879a29Richard Smith  void SetColor(SkColor color);
34baf45d31f18e6d5b3d2a33695c2af6e6cbc4ee29Anders Carlsson
3534b41d939a1328f484511c6002ba2456db879a29Richard Smith  // aura::WindowObserver overrides:
3634b41d939a1328f484511c6002ba2456db879a29Richard Smith  virtual void OnWindowBoundsChanged(aura::Window* root,
3734b41d939a1328f484511c6002ba2456db879a29Richard Smith                                     const gfx::Rect& old_bounds,
3834b41d939a1328f484511c6002ba2456db879a29Richard Smith                                     const gfx::Rect& new_bounds) OVERRIDE;
3934b41d939a1328f484511c6002ba2456db879a29Richard Smith
4034b41d939a1328f484511c6002ba2456db879a29Richard Smith private:
4134b41d939a1328f484511c6002ba2456db879a29Richard Smith  class HostContentLayerDelegate;
4234b41d939a1328f484511c6002ba2456db879a29Richard Smith
4334b41d939a1328f484511c6002ba2456db879a29Richard Smith  aura::Window* root_window_;  // not owned
4434b41d939a1328f484511c6002ba2456db879a29Richard Smith
4534b41d939a1328f484511c6002ba2456db879a29Richard Smith  scoped_ptr<ui::Layer> layer_;
463b887354b1b667c97d070ddc67b5354353c4c07bDouglas Gregor
4734b41d939a1328f484511c6002ba2456db879a29Richard Smith  DISALLOW_COPY_AND_ASSIGN(SystemBackgroundController);
4834b41d939a1328f484511c6002ba2456db879a29Richard Smith};
4931862ba5ea70b1f2c81d03f8a0100b61cd6f06f6Argyrios Kyrtzidis
5034b41d939a1328f484511c6002ba2456db879a29Richard Smith}  // namespace ash
5134b41d939a1328f484511c6002ba2456db879a29Richard Smith
5234b41d939a1328f484511c6002ba2456db879a29Richard Smith#endif  // ASH_WM_SYSTEM_BACKGROUND_CONTROLLER_H_
5334b41d939a1328f484511c6002ba2456db879a29Richard Smith