| 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_types.h" | 10 #include "ash/shelf/shelf_types.h" |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 | 50 |
| 51 // 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. |
| 52 static Shelf* ForPrimaryDisplay(); | 52 static Shelf* ForPrimaryDisplay(); |
| 53 | 53 |
| 54 // 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 |
| 55 // 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 |
| 56 // user is logged in yet. | 56 // user is logged in yet. |
| 57 static Shelf* ForWindow(const aura::Window* window); | 57 static Shelf* ForWindow(const aura::Window* window); |
| 58 | 58 |
| 59 void SetAlignment(ShelfAlignment alignment); | 59 void SetAlignment(ShelfAlignment alignment); |
| 60 ShelfAlignment alignment() const { return alignment_; } | 60 ShelfAlignment GetAlignment() const; |
| 61 bool IsHorizontalAlignment() const; | 61 bool IsHorizontalAlignment() const; |
| 62 | 62 |
| 63 // TODO(msw): Remove this accessor, kept temporarily to simplify changes. |
| 64 ShelfAlignment alignment() const { return GetAlignment(); } |
| 65 |
| 63 // Sets the ShelfAutoHideBehavior. See enum description for details. | 66 // Sets the ShelfAutoHideBehavior. See enum description for details. |
| 64 void SetAutoHideBehavior(ShelfAutoHideBehavior behavior); | 67 void SetAutoHideBehavior(ShelfAutoHideBehavior auto_hide_behavior); |
| 68 ShelfAutoHideBehavior auto_hide_behavior() const { |
| 69 return auto_hide_behavior_; |
| 70 } |
| 71 |
| 72 // TODO(msw): Remove this accessor, kept temporarily to simplify changes. |
| 65 ShelfAutoHideBehavior GetAutoHideBehavior() const; | 73 ShelfAutoHideBehavior GetAutoHideBehavior() const; |
| 66 | 74 |
| 67 // A helper functions that chooses values specific to a shelf alignment. | 75 // A helper functions that chooses values specific to a shelf alignment. |
| 68 template <typename T> | 76 template <typename T> |
| 69 T SelectValueForShelfAlignment(T bottom, T left, T right) const { | 77 T SelectValueForShelfAlignment(T bottom, T left, T right) const { |
| 70 switch (alignment_) { | 78 switch (alignment_) { |
| 71 case SHELF_ALIGNMENT_BOTTOM: | 79 case SHELF_ALIGNMENT_BOTTOM: |
| 72 return bottom; | 80 return bottom; |
| 73 case SHELF_ALIGNMENT_LEFT: | 81 case SHELF_ALIGNMENT_LEFT: |
| 74 return left; | 82 return left; |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 // Returns ApplicationDragAndDropHost for this shelf. | 141 // Returns ApplicationDragAndDropHost for this shelf. |
| 134 app_list::ApplicationDragAndDropHost* GetDragAndDropHostForAppList(); | 142 app_list::ApplicationDragAndDropHost* GetDragAndDropHostForAppList(); |
| 135 | 143 |
| 136 private: | 144 private: |
| 137 friend class test::ShelfTestAPI; | 145 friend class test::ShelfTestAPI; |
| 138 | 146 |
| 139 // ShelfView used to display icons. | 147 // ShelfView used to display icons. |
| 140 ShelfView* shelf_view_; | 148 ShelfView* shelf_view_; |
| 141 | 149 |
| 142 ShelfAlignment alignment_; | 150 ShelfAlignment alignment_; |
| 151 ShelfAutoHideBehavior auto_hide_behavior_; |
| 143 | 152 |
| 144 ShelfDelegate* delegate_; | 153 ShelfDelegate* delegate_; |
| 145 | 154 |
| 146 ShelfWidget* shelf_widget_; | 155 ShelfWidget* shelf_widget_; |
| 147 | 156 |
| 148 DISALLOW_COPY_AND_ASSIGN(Shelf); | 157 DISALLOW_COPY_AND_ASSIGN(Shelf); |
| 149 }; | 158 }; |
| 150 | 159 |
| 151 } // namespace ash | 160 } // namespace ash |
| 152 | 161 |
| 153 #endif // ASH_SHELF_SHELF_H_ | 162 #endif // ASH_SHELF_SHELF_H_ |
| OLD | NEW |