Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 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" |
Torne (Richard Coles) | 7d4cd47 | 2013-06-19 11:58:07 +0100 | [diff] [blame] | 14 | #include "ui/aura/window_observer.h" |
Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 15 | |
Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 16 | namespace ui { |
| 17 | class Layer; |
| 18 | } |
| 19 | |
| 20 | namespace ash { |
Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 21 | |
| 22 | // SystemBackgroundController manages a ui::Layer that's stacked at the bottom |
| 23 | // of an aura::RootWindow's children. It exists solely to obscure portions of |
| 24 | // the root layer that aren't covered by any other layers (e.g. before the |
| 25 | // desktop background image is loaded at startup, or when we scale down all of |
| 26 | // the other layers as part of a power-button or window-management animation). |
| 27 | // It should never be transformed or restacked. |
Torne (Richard Coles) | 7d4cd47 | 2013-06-19 11:58:07 +0100 | [diff] [blame] | 28 | class SystemBackgroundController : public aura::WindowObserver { |
Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 29 | public: |
Torne (Richard Coles) | f2477e0 | 2013-11-28 11:55:43 +0000 | [diff] [blame] | 30 | SystemBackgroundController(aura::Window* root_window, SkColor color); |
Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 31 | virtual ~SystemBackgroundController(); |
| 32 | |
| 33 | void SetColor(SkColor color); |
| 34 | |
Torne (Richard Coles) | 7d4cd47 | 2013-06-19 11:58:07 +0100 | [diff] [blame] | 35 | // aura::WindowObserver overrides: |
| 36 | virtual void OnWindowBoundsChanged(aura::Window* root, |
| 37 | const gfx::Rect& old_bounds, |
| 38 | const gfx::Rect& new_bounds) OVERRIDE; |
Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 39 | |
| 40 | private: |
| 41 | class HostContentLayerDelegate; |
| 42 | |
Torne (Richard Coles) | f2477e0 | 2013-11-28 11:55:43 +0000 | [diff] [blame] | 43 | aura::Window* root_window_; // not owned |
Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 44 | |
| 45 | scoped_ptr<ui::Layer> layer_; |
| 46 | |
| 47 | DISALLOW_COPY_AND_ASSIGN(SystemBackgroundController); |
| 48 | }; |
| 49 | |
Torne (Richard Coles) | 5821806 | 2012-11-14 11:43:16 +0000 | [diff] [blame] | 50 | } // namespace ash |
| 51 | |
| 52 | #endif // ASH_WM_SYSTEM_BACKGROUND_CONTROLLER_H_ |