OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_H_ | 5 #ifndef ASH_SHELF_SHELF_H_ |
6 #define ASH_SHELF_SHELF_H_ | 6 #define ASH_SHELF_SHELF_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <memory> | 10 #include <memory> |
11 | 11 |
12 #include "ash/ash_export.h" | 12 #include "ash/ash_export.h" |
13 #include "ash/common/shelf/shelf_background_animator_observer.h" | |
13 #include "ash/common/shelf/shelf_constants.h" | 14 #include "ash/common/shelf/shelf_constants.h" |
14 #include "ash/common/shelf/shelf_locking_manager.h" | 15 #include "ash/common/shelf/shelf_locking_manager.h" |
15 #include "ash/common/shelf/shelf_types.h" | 16 #include "ash/common/shelf/shelf_types.h" |
16 #include "ash/shelf/shelf_widget.h" | 17 #include "ash/shelf/shelf_widget.h" |
17 #include "base/macros.h" | 18 #include "base/macros.h" |
18 #include "ui/gfx/geometry/size.h" | 19 #include "ui/gfx/geometry/size.h" |
19 #include "ui/views/widget/widget_observer.h" | 20 #include "ui/views/widget/widget_observer.h" |
20 | 21 |
21 namespace app_list { | 22 namespace app_list { |
22 class ApplicationDragAndDropHost; | 23 class ApplicationDragAndDropHost; |
(...skipping 19 matching lines...) Expand all Loading... | |
42 class ShelfModel; | 43 class ShelfModel; |
43 class ShelfView; | 44 class ShelfView; |
44 class WmShelf; | 45 class WmShelf; |
45 | 46 |
46 namespace test { | 47 namespace test { |
47 class ShelfTestAPI; | 48 class ShelfTestAPI; |
48 } | 49 } |
49 | 50 |
50 // Controller for shelf state. All access to state (visibility, auto-hide, etc.) | 51 // Controller for shelf state. All access to state (visibility, auto-hide, etc.) |
51 // should occur via this class. | 52 // should occur via this class. |
52 class ASH_EXPORT Shelf { | 53 class ASH_EXPORT Shelf : public ShelfBackgroundAnimatorObserver { |
James Cook
2016/07/27 00:30:39
Can the ShelfBackgroundAnimatorObserver live somew
bruthig
2016/07/27 17:05:45
I made the ShelfView extend the ShelfBackgroundAni
| |
53 public: | 54 public: |
54 static const char kNativeViewName[]; | 55 static const char kNativeViewName[]; |
55 | 56 |
56 Shelf(ShelfModel* model, | 57 Shelf(ShelfModel* model, |
57 WmShelf* wm_shelf, | 58 WmShelf* wm_shelf, |
58 ShelfWidget* widget); | 59 ShelfWidget* widget); |
59 virtual ~Shelf(); | 60 ~Shelf() override; |
60 | 61 |
61 // Return the shelf for the primary display. NULL if no user is logged in yet. | 62 // Return the shelf for the primary display. NULL if no user is logged in yet. |
62 // Useful for tests. For production code use ForWindow() because the user may | 63 // Useful for tests. For production code use ForWindow() because the user may |
63 // have multiple displays. | 64 // have multiple displays. |
64 static Shelf* ForPrimaryDisplay(); | 65 static Shelf* ForPrimaryDisplay(); |
65 | 66 |
66 // Return the shelf for the display that |window| is currently on, or a shelf | 67 // Return the shelf for the display that |window| is currently on, or a shelf |
67 // on primary display if the shelf per display feature is disabled. NULL if no | 68 // on primary display if the shelf per display feature is disabled. NULL if no |
68 // user is logged in yet. | 69 // user is logged in yet. |
69 static Shelf* ForWindow(const aura::Window* window); | 70 static Shelf* ForWindow(const aura::Window* window); |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
145 return shelf_widget_->shelf_layout_manager(); | 146 return shelf_widget_->shelf_layout_manager(); |
146 } | 147 } |
147 | 148 |
148 // Returns rectangle bounding all visible shelf items. Used screen coordinate | 149 // Returns rectangle bounding all visible shelf items. Used screen coordinate |
149 // system. | 150 // system. |
150 gfx::Rect GetVisibleItemsBoundsInScreen() const; | 151 gfx::Rect GetVisibleItemsBoundsInScreen() const; |
151 | 152 |
152 // Returns ApplicationDragAndDropHost for this shelf. | 153 // Returns ApplicationDragAndDropHost for this shelf. |
153 app_list::ApplicationDragAndDropHost* GetDragAndDropHostForAppList(); | 154 app_list::ApplicationDragAndDropHost* GetDragAndDropHostForAppList(); |
154 | 155 |
156 // ShelfBackgroundAnimatorObserver: | |
157 void UpdateShelfItemBackground(int alpha) override; | |
158 | |
155 ShelfLockingManager* shelf_locking_manager_for_testing() { | 159 ShelfLockingManager* shelf_locking_manager_for_testing() { |
156 return &shelf_locking_manager_; | 160 return &shelf_locking_manager_; |
157 } | 161 } |
158 | 162 |
159 private: | 163 private: |
160 friend class test::ShelfTestAPI; | 164 friend class test::ShelfTestAPI; |
161 | 165 |
162 // The shelf controller. Owned by the root window controller. | 166 // The shelf controller. Owned by the root window controller. |
163 WmShelf* wm_shelf_; | 167 WmShelf* wm_shelf_; |
164 ShelfWidget* shelf_widget_; | 168 ShelfWidget* shelf_widget_; |
165 ShelfView* shelf_view_; | 169 ShelfView* shelf_view_; |
166 ShelfLockingManager shelf_locking_manager_; | 170 ShelfLockingManager shelf_locking_manager_; |
167 | 171 |
168 ShelfAlignment alignment_ = SHELF_ALIGNMENT_BOTTOM; | 172 ShelfAlignment alignment_ = SHELF_ALIGNMENT_BOTTOM; |
169 ShelfAutoHideBehavior auto_hide_behavior_ = SHELF_AUTO_HIDE_BEHAVIOR_NEVER; | 173 ShelfAutoHideBehavior auto_hide_behavior_ = SHELF_AUTO_HIDE_BEHAVIOR_NEVER; |
170 | 174 |
171 DISALLOW_COPY_AND_ASSIGN(Shelf); | 175 DISALLOW_COPY_AND_ASSIGN(Shelf); |
172 }; | 176 }; |
173 | 177 |
174 } // namespace ash | 178 } // namespace ash |
175 | 179 |
176 #endif // ASH_SHELF_SHELF_H_ | 180 #endif // ASH_SHELF_SHELF_H_ |
OLD | NEW |