OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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 ASH_SHELF_SHELF_WIDGET_H_ | 5 #ifndef ASH_SHELF_SHELF_WIDGET_H_ |
6 #define ASH_SHELF_SHELF_WIDGET_H_ | 6 #define ASH_SHELF_SHELF_WIDGET_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 | 9 |
10 #include "ash/ash_export.h" | 10 #include "ash/ash_export.h" |
11 #include "ash/public/cpp/shelf_types.h" | 11 #include "ash/public/cpp/shelf_types.h" |
12 #include "ash/shelf/shelf_background_animator.h" | 12 #include "ash/shelf/shelf_background_animator.h" |
13 #include "ash/shelf/shelf_background_animator_observer.h" | 13 #include "ash/shelf/shelf_background_animator_observer.h" |
14 #include "ash/shelf/shelf_layout_manager_observer.h" | 14 #include "ash/shelf/shelf_layout_manager_observer.h" |
15 #include "base/macros.h" | 15 #include "base/macros.h" |
16 #include "ui/views/widget/widget.h" | 16 #include "ui/views/widget/widget.h" |
17 #include "ui/views/widget/widget_observer.h" | 17 #include "ui/views/widget/widget_observer.h" |
18 | 18 |
19 namespace app_list { | 19 namespace app_list { |
20 class ApplicationDragAndDropHost; | 20 class ApplicationDragAndDropHost; |
21 } | 21 } |
22 | 22 |
23 namespace ash { | 23 namespace ash { |
24 enum class AnimationChangeType; | 24 enum class AnimationChangeType; |
25 class AppListButton; | 25 class AppListButton; |
26 class FocusCycler; | 26 class FocusCycler; |
| 27 class Shelf; |
27 class ShelfLayoutManager; | 28 class ShelfLayoutManager; |
28 class ShelfView; | 29 class ShelfView; |
29 class StatusAreaWidget; | 30 class StatusAreaWidget; |
30 class WmShelf; | |
31 class WmWindow; | 31 class WmWindow; |
32 | 32 |
33 // The ShelfWidget manages the shelf view (which contains the shelf icons) and | 33 // The ShelfWidget manages the shelf view (which contains the shelf icons) and |
34 // the status area widget. There is one ShelfWidget per display. It is created | 34 // the status area widget. There is one ShelfWidget per display. It is created |
35 // early during RootWindowController initialization. | 35 // early during RootWindowController initialization. |
36 class ASH_EXPORT ShelfWidget : public views::Widget, | 36 class ASH_EXPORT ShelfWidget : public views::Widget, |
37 public views::WidgetObserver, | 37 public views::WidgetObserver, |
38 public ShelfBackgroundAnimatorObserver, | 38 public ShelfBackgroundAnimatorObserver, |
39 public ShelfLayoutManagerObserver { | 39 public ShelfLayoutManagerObserver { |
40 public: | 40 public: |
41 ShelfWidget(WmWindow* shelf_container, WmShelf* wm_shelf); | 41 ShelfWidget(WmWindow* shelf_container, Shelf* shelf); |
42 ~ShelfWidget() override; | 42 ~ShelfWidget() override; |
43 | 43 |
44 void CreateStatusAreaWidget(WmWindow* status_container); | 44 void CreateStatusAreaWidget(WmWindow* status_container); |
45 | 45 |
46 void OnShelfAlignmentChanged(); | 46 void OnShelfAlignmentChanged(); |
47 | 47 |
48 // Sets the shelf's background type. | 48 // Sets the shelf's background type. |
49 void SetPaintsBackground(ShelfBackgroundType background_type, | 49 void SetPaintsBackground(ShelfBackgroundType background_type, |
50 AnimationChangeType change_type); | 50 AnimationChangeType change_type); |
51 ShelfBackgroundType GetBackgroundType() const; | 51 ShelfBackgroundType GetBackgroundType() const; |
(...skipping 16 matching lines...) Expand all Loading... |
68 void SetFocusCycler(FocusCycler* focus_cycler); | 68 void SetFocusCycler(FocusCycler* focus_cycler); |
69 FocusCycler* GetFocusCycler(); | 69 FocusCycler* GetFocusCycler(); |
70 | 70 |
71 // Called by the activation delegate, before the shelf is activated | 71 // Called by the activation delegate, before the shelf is activated |
72 // when no other windows are visible. | 72 // when no other windows are visible. |
73 void WillActivateAsFallback() { activating_as_fallback_ = true; } | 73 void WillActivateAsFallback() { activating_as_fallback_ = true; } |
74 | 74 |
75 // Clean up prior to deletion. | 75 // Clean up prior to deletion. |
76 void Shutdown(); | 76 void Shutdown(); |
77 | 77 |
78 // See WmShelf::UpdateIconPositionForPanel(). | 78 // See Shelf::UpdateIconPositionForPanel(). |
79 void UpdateIconPositionForPanel(WmWindow* panel); | 79 void UpdateIconPositionForPanel(WmWindow* panel); |
80 | 80 |
81 // See WmShelf::GetScreenBoundsOfItemIconForWindow(). | 81 // See Shelf::GetScreenBoundsOfItemIconForWindow(). |
82 gfx::Rect GetScreenBoundsOfItemIconForWindow(WmWindow* window); | 82 gfx::Rect GetScreenBoundsOfItemIconForWindow(WmWindow* window); |
83 | 83 |
84 // Returns the button that opens the app launcher. | 84 // Returns the button that opens the app launcher. |
85 AppListButton* GetAppListButton() const; | 85 AppListButton* GetAppListButton() const; |
86 | 86 |
87 // Returns the ApplicationDragAndDropHost for this shelf. | 87 // Returns the ApplicationDragAndDropHost for this shelf. |
88 app_list::ApplicationDragAndDropHost* GetDragAndDropHostForAppList(); | 88 app_list::ApplicationDragAndDropHost* GetDragAndDropHostForAppList(); |
89 | 89 |
90 // Overridden from views::WidgetObserver: | 90 // Overridden from views::WidgetObserver: |
91 void OnWidgetActivationChanged(views::Widget* widget, bool active) override; | 91 void OnWidgetActivationChanged(views::Widget* widget, bool active) override; |
92 | 92 |
93 // ShelfBackgroundAnimatorObserver overrides: | 93 // ShelfBackgroundAnimatorObserver overrides: |
94 void UpdateShelfItemBackground(SkColor color) override; | 94 void UpdateShelfItemBackground(SkColor color) override; |
95 | 95 |
96 // ShelfLayoutManagerObserver overrides: | 96 // ShelfLayoutManagerObserver overrides: |
97 void WillDeleteShelfLayoutManager() override; | 97 void WillDeleteShelfLayoutManager() override; |
98 | 98 |
99 // Internal implementation detail. Do not expose outside of tests. | 99 // Internal implementation detail. Do not expose outside of tests. |
100 ShelfView* shelf_view_for_testing() const { return shelf_view_; } | 100 ShelfView* shelf_view_for_testing() const { return shelf_view_; } |
101 | 101 |
102 private: | 102 private: |
103 class DelegateView; | 103 class DelegateView; |
104 friend class DelegateView; | 104 friend class DelegateView; |
105 | 105 |
106 WmShelf* wm_shelf_; | 106 Shelf* shelf_; |
107 | 107 |
108 // Owned by the shelf container's window. | 108 // Owned by the shelf container's window. |
109 ShelfLayoutManager* shelf_layout_manager_; | 109 ShelfLayoutManager* shelf_layout_manager_; |
110 | 110 |
111 // Owned by the native widget. | 111 // Owned by the native widget. |
112 StatusAreaWidget* status_area_widget_; | 112 StatusAreaWidget* status_area_widget_; |
113 | 113 |
114 // |delegate_view_| is the contents view of this widget and is cleaned up | 114 // |delegate_view_| is the contents view of this widget and is cleaned up |
115 // during CloseChildWindows of the associated RootWindowController. | 115 // during CloseChildWindows of the associated RootWindowController. |
116 DelegateView* delegate_view_; | 116 DelegateView* delegate_view_; |
117 // View containing the shelf items. Owned by the views hierarchy. | 117 // View containing the shelf items. Owned by the views hierarchy. |
118 ShelfView* const shelf_view_; | 118 ShelfView* const shelf_view_; |
119 ShelfBackgroundAnimator background_animator_; | 119 ShelfBackgroundAnimator background_animator_; |
120 bool activating_as_fallback_; | 120 bool activating_as_fallback_; |
121 | 121 |
122 DISALLOW_COPY_AND_ASSIGN(ShelfWidget); | 122 DISALLOW_COPY_AND_ASSIGN(ShelfWidget); |
123 }; | 123 }; |
124 | 124 |
125 } // namespace ash | 125 } // namespace ash |
126 | 126 |
127 #endif // ASH_SHELF_SHELF_WIDGET_H_ | 127 #endif // ASH_SHELF_SHELF_WIDGET_H_ |
OLD | NEW |