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

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

Issue 2036353002: mash: Move ash/common/wm/shelf to ash/common/shelf (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase again Created 4 years, 6 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/shelf/overflow_button.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>
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_view.h" 16 #include "ash/shelf/shelf_view.h"
17 #include "ash/shelf/shelf_widget.h" 17 #include "ash/shelf/shelf_widget.h"
18 #include "base/macros.h" 18 #include "base/macros.h"
19 #include "ui/gfx/geometry/size.h" 19 #include "ui/gfx/geometry/size.h"
20 #include "ui/views/widget/widget_observer.h" 20 #include "ui/views/widget/widget_observer.h"
21 21
22 namespace app_list { 22 namespace app_list {
23 class ApplicationDragAndDropHost; 23 class ApplicationDragAndDropHost;
24 } 24 }
25 25
26 namespace aura { 26 namespace aura {
27 class Window; 27 class Window;
28 } 28 }
29 29
30 namespace gfx { 30 namespace gfx {
31 class Rect; 31 class Rect;
32 } 32 }
33 33
34 namespace views { 34 namespace views {
35 class View; 35 class View;
36 } 36 }
37 37
38 namespace ash { 38 namespace ash {
39 class FocusCycler; 39 class FocusCycler;
40 class ShelfDelegate; 40 class ShelfDelegate;
41 class ShelfIconObserver; 41 class ShelfIconObserver;
42 class ShelfModel; 42 class ShelfModel;
43
44 namespace wm {
45 class WmShelfAura; 43 class WmShelfAura;
46 }
47 44
48 namespace test { 45 namespace test {
49 class ShelfTestAPI; 46 class ShelfTestAPI;
50 } 47 }
51 48
52 // Controller for shelf state. All access to state (visibility, auto-hide, etc.) 49 // Controller for shelf state. All access to state (visibility, auto-hide, etc.)
53 // should occur via this class. 50 // should occur via this class.
54 class ASH_EXPORT Shelf { 51 class ASH_EXPORT Shelf {
55 public: 52 public:
56 static const char kNativeViewName[]; 53 static const char kNativeViewName[];
57 54
58 Shelf(ShelfModel* model, ShelfDelegate* delegate, ShelfWidget* widget); 55 Shelf(ShelfModel* model, ShelfDelegate* delegate, ShelfWidget* widget);
59 virtual ~Shelf(); 56 virtual ~Shelf();
60 57
61 // Return the shelf for the primary display. NULL if no user is logged in yet. 58 // 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 59 // Useful for tests. For production code use ForWindow() because the user may
63 // have multiple displays. 60 // have multiple displays.
64 static Shelf* ForPrimaryDisplay(); 61 static Shelf* ForPrimaryDisplay();
65 62
66 // Return the shelf for the display that |window| is currently on, or a shelf 63 // 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 64 // on primary display if the shelf per display feature is disabled. NULL if no
68 // user is logged in yet. 65 // user is logged in yet.
69 static Shelf* ForWindow(const aura::Window* window); 66 static Shelf* ForWindow(const aura::Window* window);
70 67
71 // Returns the shelf for the display with |display_id| or null if that display 68 // Returns the shelf for the display with |display_id| or null if that display
72 // does not exist or does not have a shelf. 69 // does not exist or does not have a shelf.
73 static Shelf* ForDisplayId(int64_t display_id); 70 static Shelf* ForDisplayId(int64_t display_id);
74 71
75 void SetAlignment(wm::ShelfAlignment alignment); 72 void SetAlignment(ShelfAlignment alignment);
76 wm::ShelfAlignment alignment() const { return alignment_; } 73 ShelfAlignment alignment() const { return alignment_; }
77 bool IsHorizontalAlignment() const; 74 bool IsHorizontalAlignment() const;
78 75
79 // Sets the ShelfAutoHideBehavior. See enum description for details. 76 // Sets the ShelfAutoHideBehavior. See enum description for details.
80 void SetAutoHideBehavior(ShelfAutoHideBehavior auto_hide_behavior); 77 void SetAutoHideBehavior(ShelfAutoHideBehavior auto_hide_behavior);
81 ShelfAutoHideBehavior auto_hide_behavior() const { 78 ShelfAutoHideBehavior auto_hide_behavior() const {
82 return auto_hide_behavior_; 79 return auto_hide_behavior_;
83 } 80 }
84 81
85 ShelfAutoHideState GetAutoHideState() const; 82 ShelfAutoHideState GetAutoHideState() const;
86 83
87 ShelfVisibilityState GetVisibilityState() const; 84 ShelfVisibilityState GetVisibilityState() const;
88 85
89 // A helper functions that chooses values specific to a shelf alignment. 86 // A helper functions that chooses values specific to a shelf alignment.
90 template <typename T> 87 template <typename T>
91 T SelectValueForShelfAlignment(T bottom, T left, T right) const { 88 T SelectValueForShelfAlignment(T bottom, T left, T right) const {
92 switch (alignment_) { 89 switch (alignment_) {
93 case wm::SHELF_ALIGNMENT_BOTTOM: 90 case SHELF_ALIGNMENT_BOTTOM:
94 case wm::SHELF_ALIGNMENT_BOTTOM_LOCKED: 91 case SHELF_ALIGNMENT_BOTTOM_LOCKED:
95 return bottom; 92 return bottom;
96 case wm::SHELF_ALIGNMENT_LEFT: 93 case SHELF_ALIGNMENT_LEFT:
97 return left; 94 return left;
98 case wm::SHELF_ALIGNMENT_RIGHT: 95 case SHELF_ALIGNMENT_RIGHT:
99 return right; 96 return right;
100 } 97 }
101 NOTREACHED(); 98 NOTREACHED();
102 return right; 99 return right;
103 } 100 }
104 101
105 // A helper functions that chooses values specific to a shelf alignment type. 102 // A helper functions that chooses values specific to a shelf alignment type.
106 template <typename T> 103 template <typename T>
107 T PrimaryAxisValue(T horizontal, T vertical) const { 104 T PrimaryAxisValue(T horizontal, T vertical) const {
108 return IsHorizontalAlignment() ? horizontal : vertical; 105 return IsHorizontalAlignment() ? horizontal : vertical;
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
151 return shelf_widget_->shelf_layout_manager(); 148 return shelf_widget_->shelf_layout_manager();
152 } 149 }
153 150
154 // Returns rectangle bounding all visible shelf items. Used screen coordinate 151 // Returns rectangle bounding all visible shelf items. Used screen coordinate
155 // system. 152 // system.
156 gfx::Rect GetVisibleItemsBoundsInScreen() const; 153 gfx::Rect GetVisibleItemsBoundsInScreen() const;
157 154
158 // Returns ApplicationDragAndDropHost for this shelf. 155 // Returns ApplicationDragAndDropHost for this shelf.
159 app_list::ApplicationDragAndDropHost* GetDragAndDropHostForAppList(); 156 app_list::ApplicationDragAndDropHost* GetDragAndDropHostForAppList();
160 157
161 wm::WmShelfAura* wm_shelf() { return wm_shelf_.get(); } 158 WmShelfAura* wm_shelf() { return wm_shelf_.get(); }
162 159
163 private: 160 private:
164 friend class test::ShelfTestAPI; 161 friend class test::ShelfTestAPI;
165 162
166 std::unique_ptr<wm::WmShelfAura> wm_shelf_; 163 std::unique_ptr<WmShelfAura> wm_shelf_;
167 ShelfDelegate* delegate_; 164 ShelfDelegate* delegate_;
168 ShelfWidget* shelf_widget_; 165 ShelfWidget* shelf_widget_;
169 ShelfView* shelf_view_; 166 ShelfView* shelf_view_;
170 ShelfLockingManager shelf_locking_manager_; 167 ShelfLockingManager shelf_locking_manager_;
171 168
172 wm::ShelfAlignment alignment_ = wm::SHELF_ALIGNMENT_BOTTOM; 169 ShelfAlignment alignment_ = SHELF_ALIGNMENT_BOTTOM;
173 ShelfAutoHideBehavior auto_hide_behavior_ = SHELF_AUTO_HIDE_BEHAVIOR_NEVER; 170 ShelfAutoHideBehavior auto_hide_behavior_ = SHELF_AUTO_HIDE_BEHAVIOR_NEVER;
174 171
175 DISALLOW_COPY_AND_ASSIGN(Shelf); 172 DISALLOW_COPY_AND_ASSIGN(Shelf);
176 }; 173 };
177 174
178 } // namespace ash 175 } // namespace ash
179 176
180 #endif // ASH_SHELF_SHELF_H_ 177 #endif // ASH_SHELF_SHELF_H_
OLDNEW
« no previous file with comments | « ash/shelf/overflow_button.cc ('k') | ash/shelf/shelf.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698