OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef VIEWS_DESKTOP_DESKTOP_WINDOW_H_ | 5 #ifndef VIEWS_DESKTOP_DESKTOP_WINDOW_H_ |
6 #define VIEWS_DESKTOP_DESKTOP_WINDOW_H_ | 6 #define VIEWS_DESKTOP_DESKTOP_WINDOW_H_ |
7 | 7 |
8 #include "views/view.h" | 8 #include "views/view.h" |
9 #include "views/widget/widget.h" | |
10 #include "views/widget/widget_delegate.h" | 9 #include "views/widget/widget_delegate.h" |
11 | 10 |
12 namespace views { | 11 namespace views { |
13 class NativeWidgetViews; | 12 class NativeWidgetViews; |
| 13 class Widget; |
14 | 14 |
15 namespace desktop { | 15 namespace desktop { |
16 | 16 |
17 class DesktopWindowView : public WidgetDelegateView, | 17 class DesktopWindowView : public WidgetDelegateView { |
18 public Widget::Observer { | |
19 public: | 18 public: |
20 // The look and feel will be slightly different for different kinds of | 19 // The look and feel will be slightly different for different kinds of |
21 // desktop. | 20 // desktop. |
22 enum DesktopType { | 21 enum DesktopType { |
23 DESKTOP_DEFAULT, | 22 DESKTOP_DEFAULT, |
24 DESKTOP_NETBOOK, | 23 DESKTOP_NETBOOK, |
25 DESKTOP_OTHER | 24 DESKTOP_OTHER |
26 }; | 25 }; |
27 | 26 |
28 static DesktopWindowView* desktop_window_view; | 27 static DesktopWindowView* desktop_window_view; |
29 | 28 |
30 DesktopWindowView(DesktopType type); | 29 DesktopWindowView(DesktopType type); |
31 virtual ~DesktopWindowView(); | 30 virtual ~DesktopWindowView(); |
32 | 31 |
33 static void CreateDesktopWindow(DesktopType type); | 32 static void CreateDesktopWindow(DesktopType type); |
34 | 33 |
35 // Changes activation to the specified Widget. The currently active Widget | |
36 // is de-activated. | |
37 void ActivateWidget(Widget* widget); | |
38 | |
39 NativeWidgetViews* active_native_widget() { return active_native_widget_; } | |
40 | |
41 void CreateTestWindow(const std::wstring& title, | 34 void CreateTestWindow(const std::wstring& title, |
42 SkColor color, | 35 SkColor color, |
43 gfx::Rect initial_bounds, | 36 gfx::Rect initial_bounds, |
44 bool rotate); | 37 bool rotate); |
45 | 38 |
46 DesktopType type() const { return type_; } | 39 DesktopType type() const { return type_; } |
47 | 40 |
48 private: | 41 private: |
49 // Overridden from View: | 42 // Overridden from View: |
50 virtual void Layout() OVERRIDE; | 43 virtual void Layout() OVERRIDE; |
51 virtual void ViewHierarchyChanged( | 44 virtual void ViewHierarchyChanged( |
52 bool is_add, View* parent, View* child) OVERRIDE; | 45 bool is_add, View* parent, View* child) OVERRIDE; |
53 | 46 |
54 // Overridden from WidgetDelegate: | 47 // Overridden from WidgetDelegate: |
55 virtual Widget* GetWidget() OVERRIDE; | 48 virtual Widget* GetWidget() OVERRIDE; |
56 virtual const Widget* GetWidget() const OVERRIDE; | 49 virtual const Widget* GetWidget() const OVERRIDE; |
57 virtual bool CanResize() const OVERRIDE; | 50 virtual bool CanResize() const OVERRIDE; |
58 virtual bool CanMaximize() const OVERRIDE; | 51 virtual bool CanMaximize() const OVERRIDE; |
59 virtual std::wstring GetWindowTitle() const OVERRIDE; | 52 virtual std::wstring GetWindowTitle() const OVERRIDE; |
60 virtual SkBitmap GetWindowAppIcon() OVERRIDE; | 53 virtual SkBitmap GetWindowAppIcon() OVERRIDE; |
61 virtual SkBitmap GetWindowIcon() OVERRIDE; | 54 virtual SkBitmap GetWindowIcon() OVERRIDE; |
62 virtual bool ShouldShowWindowIcon() const OVERRIDE; | 55 virtual bool ShouldShowWindowIcon() const OVERRIDE; |
63 virtual void WindowClosing() OVERRIDE; | 56 virtual void WindowClosing() OVERRIDE; |
64 virtual View* GetContentsView() OVERRIDE; | 57 virtual View* GetContentsView() OVERRIDE; |
65 virtual NonClientFrameView* CreateNonClientFrameView() OVERRIDE; | 58 virtual NonClientFrameView* CreateNonClientFrameView() OVERRIDE; |
66 | 59 |
67 // Overridden from Widget::Observer. | |
68 virtual void OnWidgetClosing(Widget* widget) OVERRIDE; | |
69 virtual void OnWidgetVisibilityChanged(Widget* widget, bool visible) OVERRIDE; | |
70 virtual void OnWidgetActivationChanged(Widget* widget, bool active) OVERRIDE; | |
71 | |
72 NativeWidgetViews* active_native_widget_; | |
73 DesktopType type_; | 60 DesktopType type_; |
74 Widget* widget_; | 61 Widget* widget_; |
75 | 62 |
76 DISALLOW_COPY_AND_ASSIGN(DesktopWindowView); | 63 DISALLOW_COPY_AND_ASSIGN(DesktopWindowView); |
77 }; | 64 }; |
78 | 65 |
79 } // namespace desktop | 66 } // namespace desktop |
80 } // namespace views | 67 } // namespace views |
81 | 68 |
82 #endif // VIEWS_DESKTOP_DESKTOP_WINDOW_H_ | 69 #endif // VIEWS_DESKTOP_DESKTOP_WINDOW_H_ |
OLD | NEW |