Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(77)

Side by Side Diff: ash/shelf/shelf.h

Issue 2228713003: mash: Convert ShelfView to wm common types, clean up Shelf access (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix control reaches end of non-void function warnings Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ash/metrics/user_metrics_recorder.cc ('k') | ash/shelf/shelf.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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>
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 // have multiple displays. 63 // have multiple displays.
64 static Shelf* ForPrimaryDisplay(); 64 static Shelf* ForPrimaryDisplay();
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 void SetAlignment(ShelfAlignment alignment); 71 void SetAlignment(ShelfAlignment alignment);
72 ShelfAlignment alignment() const { return alignment_; } 72 ShelfAlignment alignment() const { return alignment_; }
73 bool IsHorizontalAlignment() const;
74 73
75 // Sets the ShelfAutoHideBehavior. See enum description for details. 74 // Sets the ShelfAutoHideBehavior. See enum description for details.
76 void SetAutoHideBehavior(ShelfAutoHideBehavior auto_hide_behavior); 75 void SetAutoHideBehavior(ShelfAutoHideBehavior auto_hide_behavior);
77 ShelfAutoHideBehavior auto_hide_behavior() const { 76 ShelfAutoHideBehavior auto_hide_behavior() const {
78 return auto_hide_behavior_; 77 return auto_hide_behavior_;
79 } 78 }
80 79
81 ShelfAutoHideState GetAutoHideState() const; 80 ShelfAutoHideState GetAutoHideState() const;
82 81
83 ShelfVisibilityState GetVisibilityState() const; 82 ShelfVisibilityState GetVisibilityState() const;
84 83
85 // A helper functions that chooses values specific to a shelf alignment.
86 template <typename T>
87 T SelectValueForShelfAlignment(T bottom, T left, T right) const {
88 switch (alignment_) {
89 case SHELF_ALIGNMENT_BOTTOM:
90 case SHELF_ALIGNMENT_BOTTOM_LOCKED:
91 return bottom;
92 case SHELF_ALIGNMENT_LEFT:
93 return left;
94 case SHELF_ALIGNMENT_RIGHT:
95 return right;
96 }
97 NOTREACHED();
98 return right;
99 }
100
101 // A helper functions that chooses values specific to a shelf alignment type.
102 template <typename T>
103 T PrimaryAxisValue(T horizontal, T vertical) const {
104 return IsHorizontalAlignment() ? horizontal : vertical;
105 }
106
107 // Returns the screen bounds of the item for the specified window. If there is 84 // Returns the screen bounds of the item for the specified window. If there is
108 // no item for the specified window an empty rect is returned. 85 // no item for the specified window an empty rect is returned.
109 gfx::Rect GetScreenBoundsOfItemIconForWindow(const aura::Window* window); 86 gfx::Rect GetScreenBoundsOfItemIconForWindow(const aura::Window* window);
110 87
111 // Updates the icon position given the current window bounds. This is used 88 // Updates the icon position given the current window bounds. This is used
112 // when dragging panels to reposition them with respect to the other panels. 89 // when dragging panels to reposition them with respect to the other panels.
113 void UpdateIconPositionForWindow(aura::Window* window); 90 void UpdateIconPositionForWindow(aura::Window* window);
114 91
115 // Activates the the shelf item specified by the index in the list of shelf 92 // Activates the the shelf item specified by the index in the list of shelf
116 // items. 93 // items.
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 149
173 ShelfAlignment alignment_ = SHELF_ALIGNMENT_BOTTOM; 150 ShelfAlignment alignment_ = SHELF_ALIGNMENT_BOTTOM;
174 ShelfAutoHideBehavior auto_hide_behavior_ = SHELF_AUTO_HIDE_BEHAVIOR_NEVER; 151 ShelfAutoHideBehavior auto_hide_behavior_ = SHELF_AUTO_HIDE_BEHAVIOR_NEVER;
175 152
176 DISALLOW_COPY_AND_ASSIGN(Shelf); 153 DISALLOW_COPY_AND_ASSIGN(Shelf);
177 }; 154 };
178 155
179 } // namespace ash 156 } // namespace ash
180 157
181 #endif // ASH_SHELF_SHELF_H_ 158 #endif // ASH_SHELF_SHELF_H_
OLDNEW
« no previous file with comments | « ash/metrics/user_metrics_recorder.cc ('k') | ash/shelf/shelf.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698