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 "ash/ash_export.h" | 8 #include "ash/ash_export.h" |
9 #include "ash/shelf/shelf_constants.h" | 9 #include "ash/shelf/shelf_constants.h" |
| 10 #include "ash/shelf/shelf_locking_manager.h" |
10 #include "ash/shelf/shelf_types.h" | 11 #include "ash/shelf/shelf_types.h" |
11 #include "ash/shelf/shelf_widget.h" | 12 #include "ash/shelf/shelf_widget.h" |
12 #include "base/macros.h" | 13 #include "base/macros.h" |
13 #include "ui/gfx/geometry/size.h" | 14 #include "ui/gfx/geometry/size.h" |
14 #include "ui/views/widget/widget_observer.h" | 15 #include "ui/views/widget/widget_observer.h" |
15 | 16 |
16 namespace app_list { | 17 namespace app_list { |
17 class ApplicationDragAndDropHost; | 18 class ApplicationDragAndDropHost; |
18 } | 19 } |
19 | 20 |
(...skipping 29 matching lines...) Expand all Loading... |
49 | 50 |
50 // Return the shelf for the primary display. NULL if no user is logged in yet. | 51 // Return the shelf for the primary display. NULL if no user is logged in yet. |
51 static Shelf* ForPrimaryDisplay(); | 52 static Shelf* ForPrimaryDisplay(); |
52 | 53 |
53 // Return the shelf for the display that |window| is currently on, or a shelf | 54 // Return the shelf for the display that |window| is currently on, or a shelf |
54 // on primary display if the shelf per display feature is disabled. NULL if no | 55 // on primary display if the shelf per display feature is disabled. NULL if no |
55 // user is logged in yet. | 56 // user is logged in yet. |
56 static Shelf* ForWindow(const aura::Window* window); | 57 static Shelf* ForWindow(const aura::Window* window); |
57 | 58 |
58 void SetAlignment(ShelfAlignment alignment); | 59 void SetAlignment(ShelfAlignment alignment); |
59 ShelfAlignment GetAlignment() const; | 60 ShelfAlignment alignment() const { return alignment_; } |
60 bool IsHorizontalAlignment() const; | 61 bool IsHorizontalAlignment() const; |
61 | 62 |
62 // TODO(msw): Remove this accessor, kept temporarily to simplify changes. | |
63 ShelfAlignment alignment() const { return GetAlignment(); } | |
64 | |
65 // Sets the ShelfAutoHideBehavior. See enum description for details. | 63 // Sets the ShelfAutoHideBehavior. See enum description for details. |
66 void SetAutoHideBehavior(ShelfAutoHideBehavior auto_hide_behavior); | 64 void SetAutoHideBehavior(ShelfAutoHideBehavior auto_hide_behavior); |
67 ShelfAutoHideBehavior auto_hide_behavior() const { | 65 ShelfAutoHideBehavior auto_hide_behavior() const { |
68 return auto_hide_behavior_; | 66 return auto_hide_behavior_; |
69 } | 67 } |
70 | 68 |
71 // TODO(msw): Remove this accessor, kept temporarily to simplify changes. | 69 // TODO(msw): Remove this accessor, kept temporarily to simplify changes. |
72 ShelfAutoHideBehavior GetAutoHideBehavior() const; | 70 ShelfAutoHideBehavior GetAutoHideBehavior() const; |
73 | 71 |
74 // A helper functions that chooses values specific to a shelf alignment. | 72 // A helper functions that chooses values specific to a shelf alignment. |
75 template <typename T> | 73 template <typename T> |
76 T SelectValueForShelfAlignment(T bottom, T left, T right) const { | 74 T SelectValueForShelfAlignment(T bottom, T left, T right) const { |
77 switch (alignment_) { | 75 switch (alignment_) { |
78 case SHELF_ALIGNMENT_BOTTOM: | 76 case SHELF_ALIGNMENT_BOTTOM: |
| 77 case SHELF_ALIGNMENT_BOTTOM_LOCKED: |
79 return bottom; | 78 return bottom; |
80 case SHELF_ALIGNMENT_LEFT: | 79 case SHELF_ALIGNMENT_LEFT: |
81 return left; | 80 return left; |
82 case SHELF_ALIGNMENT_RIGHT: | 81 case SHELF_ALIGNMENT_RIGHT: |
83 return right; | 82 return right; |
84 } | 83 } |
85 NOTREACHED(); | 84 NOTREACHED(); |
86 return right; | 85 return right; |
87 } | 86 } |
88 | 87 |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 // Returns rectangle bounding all visible shelf items. Used screen coordinate | 135 // Returns rectangle bounding all visible shelf items. Used screen coordinate |
137 // system. | 136 // system. |
138 gfx::Rect GetVisibleItemsBoundsInScreen() const; | 137 gfx::Rect GetVisibleItemsBoundsInScreen() const; |
139 | 138 |
140 // Returns ApplicationDragAndDropHost for this shelf. | 139 // Returns ApplicationDragAndDropHost for this shelf. |
141 app_list::ApplicationDragAndDropHost* GetDragAndDropHostForAppList(); | 140 app_list::ApplicationDragAndDropHost* GetDragAndDropHostForAppList(); |
142 | 141 |
143 private: | 142 private: |
144 friend class test::ShelfTestAPI; | 143 friend class test::ShelfTestAPI; |
145 | 144 |
146 // ShelfView used to display icons. | 145 ShelfDelegate* delegate_; |
| 146 ShelfWidget* shelf_widget_; |
147 ShelfView* shelf_view_; | 147 ShelfView* shelf_view_; |
| 148 ShelfLockingManager shelf_locking_manager_; |
148 | 149 |
149 ShelfAlignment alignment_; | 150 ShelfAlignment alignment_ = SHELF_ALIGNMENT_BOTTOM; |
150 ShelfAutoHideBehavior auto_hide_behavior_; | 151 ShelfAutoHideBehavior auto_hide_behavior_ = SHELF_AUTO_HIDE_BEHAVIOR_NEVER; |
151 | |
152 ShelfDelegate* delegate_; | |
153 | |
154 ShelfWidget* shelf_widget_; | |
155 | 152 |
156 DISALLOW_COPY_AND_ASSIGN(Shelf); | 153 DISALLOW_COPY_AND_ASSIGN(Shelf); |
157 }; | 154 }; |
158 | 155 |
159 } // namespace ash | 156 } // namespace ash |
160 | 157 |
161 #endif // ASH_SHELF_SHELF_H_ | 158 #endif // ASH_SHELF_SHELF_H_ |
OLD | NEW |