OLD | NEW |
(Empty) | |
| 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_DESKTOP_BACKGROUND_DESKTOP_BACKGROUND_WIDGET_CONTROLLER_H_ |
| 6 #define ASH_DESKTOP_BACKGROUND_DESKTOP_BACKGROUND_WIDGET_CONTROLLER_H_ |
| 7 |
| 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "ui/aura/window_property.h" |
| 10 #include "ui/compositor/layer.h" |
| 11 #include "ui/views/widget/widget.h" |
| 12 |
| 13 namespace ash { |
| 14 namespace internal { |
| 15 |
| 16 // This class hides difference between two possible background implementations: |
| 17 // effective Layer-based for solid color, and Widget-based for images. |
| 18 class DesktopBackgroundWidgetController { |
| 19 public: |
| 20 // Create |
| 21 explicit DesktopBackgroundWidgetController(views::Widget* widget); |
| 22 explicit DesktopBackgroundWidgetController(ui::Layer* layer); |
| 23 |
| 24 ~DesktopBackgroundWidgetController(); |
| 25 |
| 26 // Set bounds of component that draws background. |
| 27 void SetBounds(gfx::Rect bounds); |
| 28 |
| 29 // Move component from |src_container| in |root_window| to |dest_container|. |
| 30 // It is required for lock screen, when we need to move background so that |
| 31 // it hides user's windows. |
| 32 void Reparent(aura::RootWindow* root_window, |
| 33 int src_container, |
| 34 int dest_container); |
| 35 |
| 36 views::Widget* widget() { return widget_; } |
| 37 ui::Layer* layer() { return layer_.get(); } |
| 38 |
| 39 private: |
| 40 views::Widget* widget_; |
| 41 scoped_ptr<ui::Layer> layer_; |
| 42 |
| 43 DISALLOW_COPY_AND_ASSIGN(DesktopBackgroundWidgetController); |
| 44 }; |
| 45 |
| 46 // Window property key, that binds instance of DesktopBackgroundWidgetController |
| 47 // to root windows. |
| 48 extern const aura::WindowProperty<DesktopBackgroundWidgetController*>* const |
| 49 kWindowDesktopComponent; |
| 50 |
| 51 } // namespace internal |
| 52 } // namespace ash |
| 53 |
| 54 #endif // ASH_DESKTOP_BACKGROUND_DESKTOP_BACKGROUND_WIDGET_CONTROLLER_H_ |
OLD | NEW |