| 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/shelf/shelf_constants.h" | 13 #include "ash/common/shelf/shelf_constants.h" |
| 14 #include "ash/common/shelf/shelf_types.h" |
| 14 #include "ash/shelf/shelf_locking_manager.h" | 15 #include "ash/shelf/shelf_locking_manager.h" |
| 15 #include "ash/shelf/shelf_types.h" | |
| 16 #include "ash/shelf/shelf_widget.h" | 16 #include "ash/shelf/shelf_widget.h" |
| 17 #include "base/macros.h" | 17 #include "base/macros.h" |
| 18 #include "ui/gfx/geometry/size.h" | 18 #include "ui/gfx/geometry/size.h" |
| 19 #include "ui/views/widget/widget_observer.h" | 19 #include "ui/views/widget/widget_observer.h" |
| 20 | 20 |
| 21 namespace app_list { | 21 namespace app_list { |
| 22 class ApplicationDragAndDropHost; | 22 class ApplicationDragAndDropHost; |
| 23 } | 23 } |
| 24 | 24 |
| 25 namespace aura { | 25 namespace aura { |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 65 | 65 |
| 66 // Return the shelf for the display that |window| is currently on, or a shelf | 66 // 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 | 67 // on primary display if the shelf per display feature is disabled. NULL if no |
| 68 // user is logged in yet. | 68 // user is logged in yet. |
| 69 static Shelf* ForWindow(const aura::Window* window); | 69 static Shelf* ForWindow(const aura::Window* window); |
| 70 | 70 |
| 71 // Returns the shelf for the display with |display_id| or null if that display | 71 // Returns the shelf for the display with |display_id| or null if that display |
| 72 // does not exist or does not have a shelf. | 72 // does not exist or does not have a shelf. |
| 73 static Shelf* ForDisplayId(int64_t display_id); | 73 static Shelf* ForDisplayId(int64_t display_id); |
| 74 | 74 |
| 75 void SetAlignment(wm::ShelfAlignment alignment); | 75 void SetAlignment(ShelfAlignment alignment); |
| 76 wm::ShelfAlignment alignment() const { return alignment_; } | 76 ShelfAlignment alignment() const { return alignment_; } |
| 77 bool IsHorizontalAlignment() const; | 77 bool IsHorizontalAlignment() const; |
| 78 | 78 |
| 79 // Sets the ShelfAutoHideBehavior. See enum description for details. | 79 // Sets the ShelfAutoHideBehavior. See enum description for details. |
| 80 void SetAutoHideBehavior(ShelfAutoHideBehavior auto_hide_behavior); | 80 void SetAutoHideBehavior(ShelfAutoHideBehavior auto_hide_behavior); |
| 81 ShelfAutoHideBehavior auto_hide_behavior() const { | 81 ShelfAutoHideBehavior auto_hide_behavior() const { |
| 82 return auto_hide_behavior_; | 82 return auto_hide_behavior_; |
| 83 } | 83 } |
| 84 | 84 |
| 85 ShelfAutoHideState GetAutoHideState() const; | 85 ShelfAutoHideState GetAutoHideState() const; |
| 86 | 86 |
| 87 ShelfVisibilityState GetVisibilityState() const; | 87 ShelfVisibilityState GetVisibilityState() const; |
| 88 | 88 |
| 89 // A helper functions that chooses values specific to a shelf alignment. | 89 // A helper functions that chooses values specific to a shelf alignment. |
| 90 template <typename T> | 90 template <typename T> |
| 91 T SelectValueForShelfAlignment(T bottom, T left, T right) const { | 91 T SelectValueForShelfAlignment(T bottom, T left, T right) const { |
| 92 switch (alignment_) { | 92 switch (alignment_) { |
| 93 case wm::SHELF_ALIGNMENT_BOTTOM: | 93 case SHELF_ALIGNMENT_BOTTOM: |
| 94 case wm::SHELF_ALIGNMENT_BOTTOM_LOCKED: | 94 case SHELF_ALIGNMENT_BOTTOM_LOCKED: |
| 95 return bottom; | 95 return bottom; |
| 96 case wm::SHELF_ALIGNMENT_LEFT: | 96 case SHELF_ALIGNMENT_LEFT: |
| 97 return left; | 97 return left; |
| 98 case wm::SHELF_ALIGNMENT_RIGHT: | 98 case SHELF_ALIGNMENT_RIGHT: |
| 99 return right; | 99 return right; |
| 100 } | 100 } |
| 101 NOTREACHED(); | 101 NOTREACHED(); |
| 102 return right; | 102 return right; |
| 103 } | 103 } |
| 104 | 104 |
| 105 // A helper functions that chooses values specific to a shelf alignment type. | 105 // A helper functions that chooses values specific to a shelf alignment type. |
| 106 template <typename T> | 106 template <typename T> |
| 107 T PrimaryAxisValue(T horizontal, T vertical) const { | 107 T PrimaryAxisValue(T horizontal, T vertical) const { |
| 108 return IsHorizontalAlignment() ? horizontal : vertical; | 108 return IsHorizontalAlignment() ? horizontal : vertical; |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 160 | 160 |
| 161 private: | 161 private: |
| 162 friend class test::ShelfTestAPI; | 162 friend class test::ShelfTestAPI; |
| 163 | 163 |
| 164 std::unique_ptr<wm::WmShelfAura> wm_shelf_; | 164 std::unique_ptr<wm::WmShelfAura> wm_shelf_; |
| 165 ShelfDelegate* delegate_; | 165 ShelfDelegate* delegate_; |
| 166 ShelfWidget* shelf_widget_; | 166 ShelfWidget* shelf_widget_; |
| 167 ShelfView* shelf_view_; | 167 ShelfView* shelf_view_; |
| 168 ShelfLockingManager shelf_locking_manager_; | 168 ShelfLockingManager shelf_locking_manager_; |
| 169 | 169 |
| 170 wm::ShelfAlignment alignment_ = wm::SHELF_ALIGNMENT_BOTTOM; | 170 ShelfAlignment alignment_ = SHELF_ALIGNMENT_BOTTOM; |
| 171 ShelfAutoHideBehavior auto_hide_behavior_ = SHELF_AUTO_HIDE_BEHAVIOR_NEVER; | 171 ShelfAutoHideBehavior auto_hide_behavior_ = SHELF_AUTO_HIDE_BEHAVIOR_NEVER; |
| 172 | 172 |
| 173 DISALLOW_COPY_AND_ASSIGN(Shelf); | 173 DISALLOW_COPY_AND_ASSIGN(Shelf); |
| 174 }; | 174 }; |
| 175 | 175 |
| 176 } // namespace ash | 176 } // namespace ash |
| 177 | 177 |
| 178 #endif // ASH_SHELF_SHELF_H_ | 178 #endif // ASH_SHELF_SHELF_H_ |
| OLD | NEW |