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

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

Issue 2899253002: chromeos: Rename ash::WmShelf to Shelf (Closed)
Patch Set: cleanup Created 3 years, 7 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
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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_WM_SHELF_H_ 5 #ifndef ASH_SHELF_SHELF_H_
6 #define ASH_SHELF_WM_SHELF_H_ 6 #define ASH_SHELF_SHELF_H_
7 7
8 #include <memory> 8 #include <memory>
9 9
10 #include "ash/ash_export.h" 10 #include "ash/ash_export.h"
11 #include "ash/public/cpp/shelf_types.h" 11 #include "ash/public/cpp/shelf_types.h"
12 #include "ash/shelf/shelf_layout_manager_observer.h" 12 #include "ash/shelf/shelf_layout_manager_observer.h"
13 #include "ash/shelf/shelf_locking_manager.h" 13 #include "ash/shelf/shelf_locking_manager.h"
14 #include "base/observer_list.h" 14 #include "base/observer_list.h"
15 15
16 namespace aura { 16 namespace aura {
(...skipping 11 matching lines...) Expand all
28 namespace ash { 28 namespace ash {
29 29
30 enum class AnimationChangeType; 30 enum class AnimationChangeType;
31 class ShelfBezelEventHandler; 31 class ShelfBezelEventHandler;
32 class ShelfLayoutManager; 32 class ShelfLayoutManager;
33 class ShelfLayoutManagerTest; 33 class ShelfLayoutManagerTest;
34 class ShelfLockingManager; 34 class ShelfLockingManager;
35 class ShelfView; 35 class ShelfView;
36 class ShelfWidget; 36 class ShelfWidget;
37 class StatusAreaWidget; 37 class StatusAreaWidget;
38 class WmShelfObserver; 38 class ShelfObserver;
39 class WmWindow; 39 class WmWindow;
40 40
41 // Controller for the shelf state. One per display, because each display might 41 // Controller for the shelf state. One per display, because each display might
42 // have different shelf alignment, autohide, etc. Exists for the lifetime of the 42 // have different shelf alignment, autohide, etc. Exists for the lifetime of the
43 // root window controller. 43 // root window controller.
44 class ASH_EXPORT WmShelf : public ShelfLayoutManagerObserver { 44 class ASH_EXPORT Shelf : public ShelfLayoutManagerObserver {
45 public: 45 public:
46 WmShelf(); 46 Shelf();
47 ~WmShelf() override; 47 ~Shelf() override;
48 48
49 // Returns the shelf for the display that |window| is on. Note that the shelf 49 // Returns the shelf for the display that |window| is on. Note that the shelf
50 // widget may not exist, or the shelf may not be visible. 50 // widget may not exist, or the shelf may not be visible.
51 static WmShelf* ForWindow(aura::Window* window); 51 static Shelf* ForWindow(aura::Window* window);
52 52
53 // Returns if shelf alignment options are enabled, and the user is able to 53 // Returns if shelf alignment options are enabled, and the user is able to
54 // adjust the alignment (eg. not allowed in guest and supervised user modes). 54 // adjust the alignment (eg. not allowed in guest and supervised user modes).
55 static bool CanChangeShelfAlignment(); 55 static bool CanChangeShelfAlignment();
56 56
57 void CreateShelfWidget(WmWindow* root); 57 void CreateShelfWidget(WmWindow* root);
58 void ShutdownShelfWidget(); 58 void ShutdownShelfWidget();
59 void DestroyShelfWidget(); 59 void DestroyShelfWidget();
60 60
61 ShelfLayoutManager* shelf_layout_manager() const { 61 ShelfLayoutManager* shelf_layout_manager() const {
62 return shelf_layout_manager_; 62 return shelf_layout_manager_;
63 } 63 }
64 64
65 ShelfWidget* shelf_widget() { return shelf_widget_.get(); } 65 ShelfWidget* shelf_widget() { return shelf_widget_.get(); }
66 66
67 // TODO(jamescook): Eliminate this method. 67 // TODO(jamescook): Eliminate this method.
68 void NotifyShelfInitialized(); 68 void NotifyShelfInitialized();
69 69
70 // Returns the window showing the shelf. 70 // Returns the window showing the shelf.
71 WmWindow* GetWindow(); 71 WmWindow* GetWindow();
72 72
73 ShelfAlignment alignment() const { return alignment_; } 73 ShelfAlignment alignment() const { return alignment_; }
74 // TODO(jamescook): Replace with alignment().
75 ShelfAlignment GetAlignment() const { return alignment_; }
msw 2017/05/24 18:42:58 nice!
76 void SetAlignment(ShelfAlignment alignment); 74 void SetAlignment(ShelfAlignment alignment);
77 75
78 // Returns true if the shelf alignment is horizontal (i.e. at the bottom). 76 // Returns true if the shelf alignment is horizontal (i.e. at the bottom).
79 bool IsHorizontalAlignment() const; 77 bool IsHorizontalAlignment() const;
80 78
81 // Returns a value based on shelf alignment. 79 // Returns a value based on shelf alignment.
82 int SelectValueForShelfAlignment(int bottom, int left, int right) const; 80 int SelectValueForShelfAlignment(int bottom, int left, int right) const;
83 81
84 // Returns |horizontal| is shelf is horizontal, otherwise |vertical|. 82 // Returns |horizontal| is shelf is horizontal, otherwise |vertical|.
85 int PrimaryAxisValue(int horizontal, int vertical) const; 83 int PrimaryAxisValue(int horizontal, int vertical) const;
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 118
121 // Activates the shelf item specified by the index in the list of shelf items. 119 // Activates the shelf item specified by the index in the list of shelf items.
122 static void ActivateShelfItem(int item_index); 120 static void ActivateShelfItem(int item_index);
123 121
124 // Handles a gesture |event| coming from a source outside the shelf widget 122 // Handles a gesture |event| coming from a source outside the shelf widget
125 // (e.g. the status area widget). Allows support for behaviors like toggling 123 // (e.g. the status area widget). Allows support for behaviors like toggling
126 // auto-hide with a swipe, even if that gesture event hits another window. 124 // auto-hide with a swipe, even if that gesture event hits another window.
127 // Returns true if the event was handled. 125 // Returns true if the event was handled.
128 bool ProcessGestureEvent(const ui::GestureEvent& event); 126 bool ProcessGestureEvent(const ui::GestureEvent& event);
129 127
130 void AddObserver(WmShelfObserver* observer); 128 void AddObserver(ShelfObserver* observer);
131 void RemoveObserver(WmShelfObserver* observer); 129 void RemoveObserver(ShelfObserver* observer);
132 130
133 void NotifyShelfIconPositionsChanged(); 131 void NotifyShelfIconPositionsChanged();
134 StatusAreaWidget* GetStatusAreaWidget() const; 132 StatusAreaWidget* GetStatusAreaWidget() const;
135 133
136 void SetVirtualKeyboardBoundsForTesting(const gfx::Rect& bounds); 134 void SetVirtualKeyboardBoundsForTesting(const gfx::Rect& bounds);
137 ShelfLockingManager* GetShelfLockingManagerForTesting(); 135 ShelfLockingManager* GetShelfLockingManagerForTesting();
138 ShelfView* GetShelfViewForTesting(); 136 ShelfView* GetShelfViewForTesting();
139 137
140 protected: 138 protected:
141 // ShelfLayoutManagerObserver: 139 // ShelfLayoutManagerObserver:
(...skipping 13 matching lines...) Expand all
155 153
156 std::unique_ptr<ShelfWidget> shelf_widget_; 154 std::unique_ptr<ShelfWidget> shelf_widget_;
157 155
158 // These initial values hide the shelf until user preferences are available. 156 // These initial values hide the shelf until user preferences are available.
159 ShelfAlignment alignment_ = SHELF_ALIGNMENT_BOTTOM_LOCKED; 157 ShelfAlignment alignment_ = SHELF_ALIGNMENT_BOTTOM_LOCKED;
160 ShelfAutoHideBehavior auto_hide_behavior_ = SHELF_AUTO_HIDE_ALWAYS_HIDDEN; 158 ShelfAutoHideBehavior auto_hide_behavior_ = SHELF_AUTO_HIDE_ALWAYS_HIDDEN;
161 159
162 // Sets shelf alignment to bottom during login and screen lock. 160 // Sets shelf alignment to bottom during login and screen lock.
163 ShelfLockingManager shelf_locking_manager_; 161 ShelfLockingManager shelf_locking_manager_;
164 162
165 base::ObserverList<WmShelfObserver> observers_; 163 base::ObserverList<ShelfObserver> observers_;
166 164
167 // Forwards mouse and gesture events to ShelfLayoutManager for auto-hide. 165 // Forwards mouse and gesture events to ShelfLayoutManager for auto-hide.
168 // TODO(mash): Facilitate simliar functionality in mash: crbug.com/631216 166 // TODO(mash): Facilitate simliar functionality in mash: crbug.com/631216
169 std::unique_ptr<AutoHideEventHandler> auto_hide_event_handler_; 167 std::unique_ptr<AutoHideEventHandler> auto_hide_event_handler_;
170 168
171 // Forwards touch gestures on a bezel sensor to the shelf. 169 // Forwards touch gestures on a bezel sensor to the shelf.
172 // TODO(mash): Facilitate simliar functionality in mash: crbug.com/636647 170 // TODO(mash): Facilitate simliar functionality in mash: crbug.com/636647
173 std::unique_ptr<ShelfBezelEventHandler> bezel_event_handler_; 171 std::unique_ptr<ShelfBezelEventHandler> bezel_event_handler_;
174 172
175 DISALLOW_COPY_AND_ASSIGN(WmShelf); 173 DISALLOW_COPY_AND_ASSIGN(Shelf);
176 }; 174 };
177 175
178 } // namespace ash 176 } // namespace ash
179 177
180 #endif // ASH_SHELF_WM_SHELF_H_ 178 #endif // ASH_SHELF_SHELF_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698