OLD | NEW |
| (Empty) |
1 // Copyright (c) 2011 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 UI_VIEWS_DESKTOP_DESKTOP_WINDOW_VIEW_H_ | |
6 #define UI_VIEWS_DESKTOP_DESKTOP_WINDOW_VIEW_H_ | |
7 | |
8 #include "base/observer_list.h" | |
9 #include "ui/gfx/compositor/layer_animation_observer.h" | |
10 #include "views/view.h" | |
11 #include "views/widget/widget_delegate.h" | |
12 | |
13 namespace ui { | |
14 class LayerAnimationSequence; | |
15 } // namespace ui | |
16 | |
17 namespace views { | |
18 | |
19 class Widget; | |
20 | |
21 namespace desktop { | |
22 | |
23 class DesktopWindowView : public WidgetDelegateView, | |
24 public ui::LayerAnimationObserver { | |
25 public: | |
26 // Observers can listen to various events on the desktop. | |
27 class Observer { | |
28 public: | |
29 virtual void OnDesktopBoundsChanged(const gfx::Rect& previous_bounds) = 0; | |
30 | |
31 protected: | |
32 virtual ~Observer() {} | |
33 }; | |
34 | |
35 // The look and feel will be slightly different for different kinds of | |
36 // desktop. | |
37 enum DesktopType { | |
38 DESKTOP_DEFAULT, | |
39 DESKTOP_NETBOOK, | |
40 DESKTOP_OTHER | |
41 }; | |
42 | |
43 static DesktopWindowView* desktop_window_view; | |
44 | |
45 explicit DesktopWindowView(DesktopType type); | |
46 virtual ~DesktopWindowView(); | |
47 | |
48 static void CreateDesktopWindow(DesktopType type); | |
49 | |
50 void CreateTestWindow(const string16& title, | |
51 SkColor color, | |
52 gfx::Rect initial_bounds, | |
53 bool rotate); | |
54 | |
55 DesktopType type() const { return type_; } | |
56 | |
57 // Add/remove observer. | |
58 void AddObserver(Observer* observer); | |
59 void RemoveObserver(Observer* observer); | |
60 bool HasObserver(Observer* observer); | |
61 | |
62 private: | |
63 // Overridden from View: | |
64 virtual void Layout() OVERRIDE; | |
65 virtual void OnBoundsChanged(const gfx::Rect& previous_bounds) OVERRIDE; | |
66 virtual void ViewHierarchyChanged( | |
67 bool is_add, View* parent, View* child) OVERRIDE; | |
68 | |
69 // Overridden from WidgetDelegate: | |
70 virtual Widget* GetWidget() OVERRIDE; | |
71 virtual const Widget* GetWidget() const OVERRIDE; | |
72 virtual bool CanResize() const OVERRIDE; | |
73 virtual bool CanMaximize() const OVERRIDE; | |
74 virtual string16 GetWindowTitle() const OVERRIDE; | |
75 virtual SkBitmap GetWindowAppIcon() OVERRIDE; | |
76 virtual SkBitmap GetWindowIcon() OVERRIDE; | |
77 virtual bool ShouldShowWindowIcon() const OVERRIDE; | |
78 virtual void WindowClosing() OVERRIDE; | |
79 virtual View* GetContentsView() OVERRIDE; | |
80 virtual NonClientFrameView* CreateNonClientFrameView() OVERRIDE; | |
81 | |
82 // Implementation of ui::LayerAnimationObserver: | |
83 virtual void OnLayerAnimationEnded( | |
84 const ui::LayerAnimationSequence* animation) OVERRIDE; | |
85 virtual void OnLayerAnimationScheduled( | |
86 const ui::LayerAnimationSequence* animation) OVERRIDE; | |
87 virtual void OnLayerAnimationAborted( | |
88 const ui::LayerAnimationSequence* animation) OVERRIDE; | |
89 | |
90 ObserverList<Observer> observers_; | |
91 DesktopType type_; | |
92 Widget* widget_; | |
93 | |
94 DISALLOW_COPY_AND_ASSIGN(DesktopWindowView); | |
95 }; | |
96 | |
97 } // namespace desktop | |
98 } // namespace views | |
99 | |
100 #endif // UI_VIEWS_DESKTOP_DESKTOP_WINDOW_VIEW_H_ | |
OLD | NEW |