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

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

Issue 2020623004: ash: Move shelf alignment and auto-hide calls from Shell to Shelf (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase 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/root_window_controller.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 <memory> 8 #include <memory>
9 9
10 #include "ash/ash_export.h" 10 #include "ash/ash_export.h"
(...skipping 29 matching lines...) Expand all
40 class ShelfView; 40 class ShelfView;
41 41
42 namespace wm { 42 namespace wm {
43 class WmShelfAura; 43 class WmShelfAura;
44 } 44 }
45 45
46 namespace test { 46 namespace test {
47 class ShelfTestAPI; 47 class ShelfTestAPI;
48 } 48 }
49 49
50 // Controller for shelf state. All access to state (visibility, auto-hide, etc.)
51 // should occur via this class.
50 class ASH_EXPORT Shelf { 52 class ASH_EXPORT Shelf {
51 public: 53 public:
52 static const char kNativeViewName[]; 54 static const char kNativeViewName[];
53 55
54 Shelf(ShelfModel* model, ShelfDelegate* delegate, ShelfWidget* widget); 56 Shelf(ShelfModel* model, ShelfDelegate* delegate, ShelfWidget* widget);
55 virtual ~Shelf(); 57 virtual ~Shelf();
56 58
57 // Return the shelf for the primary display. NULL if no user is logged in yet. 59 // Return the shelf for the primary display. NULL if no user is logged in yet.
60 // Useful for tests. For production code use ForWindow() because the user may
61 // have multiple displays.
58 static Shelf* ForPrimaryDisplay(); 62 static Shelf* ForPrimaryDisplay();
59 63
60 // Return the shelf for the display that |window| is currently on, or a shelf 64 // Return the shelf for the display that |window| is currently on, or a shelf
61 // on primary display if the shelf per display feature is disabled. NULL if no 65 // on primary display if the shelf per display feature is disabled. NULL if no
62 // user is logged in yet. 66 // user is logged in yet.
63 static Shelf* ForWindow(const aura::Window* window); 67 static Shelf* ForWindow(const aura::Window* window);
64 68
65 void SetAlignment(wm::ShelfAlignment alignment); 69 void SetAlignment(wm::ShelfAlignment alignment);
66 wm::ShelfAlignment alignment() const { return alignment_; } 70 wm::ShelfAlignment alignment() const { return alignment_; }
67 bool IsHorizontalAlignment() const; 71 bool IsHorizontalAlignment() const;
68 72
69 // Sets the ShelfAutoHideBehavior. See enum description for details. 73 // Sets the ShelfAutoHideBehavior. See enum description for details.
70 void SetAutoHideBehavior(ShelfAutoHideBehavior auto_hide_behavior); 74 void SetAutoHideBehavior(ShelfAutoHideBehavior auto_hide_behavior);
71 ShelfAutoHideBehavior auto_hide_behavior() const { 75 ShelfAutoHideBehavior auto_hide_behavior() const {
72 return auto_hide_behavior_; 76 return auto_hide_behavior_;
73 } 77 }
74 78
75 // TODO(msw): Remove this accessor, kept temporarily to simplify changes.
76 ShelfAutoHideBehavior GetAutoHideBehavior() const;
77
78 // A helper functions that chooses values specific to a shelf alignment. 79 // A helper functions that chooses values specific to a shelf alignment.
79 template <typename T> 80 template <typename T>
80 T SelectValueForShelfAlignment(T bottom, T left, T right) const { 81 T SelectValueForShelfAlignment(T bottom, T left, T right) const {
81 switch (alignment_) { 82 switch (alignment_) {
82 case wm::SHELF_ALIGNMENT_BOTTOM: 83 case wm::SHELF_ALIGNMENT_BOTTOM:
83 case wm::SHELF_ALIGNMENT_BOTTOM_LOCKED: 84 case wm::SHELF_ALIGNMENT_BOTTOM_LOCKED:
84 return bottom; 85 return bottom;
85 case wm::SHELF_ALIGNMENT_LEFT: 86 case wm::SHELF_ALIGNMENT_LEFT:
86 return left; 87 return left;
87 case wm::SHELF_ALIGNMENT_RIGHT: 88 case wm::SHELF_ALIGNMENT_RIGHT:
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 159
159 wm::ShelfAlignment alignment_ = wm::SHELF_ALIGNMENT_BOTTOM; 160 wm::ShelfAlignment alignment_ = wm::SHELF_ALIGNMENT_BOTTOM;
160 ShelfAutoHideBehavior auto_hide_behavior_ = SHELF_AUTO_HIDE_BEHAVIOR_NEVER; 161 ShelfAutoHideBehavior auto_hide_behavior_ = SHELF_AUTO_HIDE_BEHAVIOR_NEVER;
161 162
162 DISALLOW_COPY_AND_ASSIGN(Shelf); 163 DISALLOW_COPY_AND_ASSIGN(Shelf);
163 }; 164 };
164 165
165 } // namespace ash 166 } // namespace ash
166 167
167 #endif // ASH_SHELF_SHELF_H_ 168 #endif // ASH_SHELF_SHELF_H_
OLDNEW
« no previous file with comments | « ash/root_window_controller.cc ('k') | ash/shelf/shelf.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698