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

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

Issue 1743493002: Cleanup ash shelf accessor functions. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix ShelfBrowserTest. Created 4 years, 9 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 "ash/ash_export.h" 8 #include "ash/ash_export.h"
9 #include "ash/shelf/shelf_constants.h" 9 #include "ash/shelf/shelf_constants.h"
10 #include "ash/shelf/shelf_types.h" 10 #include "ash/shelf/shelf_types.h"
11 #include "ash/shelf/shelf_widget.h"
11 #include "base/macros.h" 12 #include "base/macros.h"
12 #include "base/memory/scoped_ptr.h" 13 #include "base/memory/scoped_ptr.h"
13 #include "ui/gfx/geometry/size.h" 14 #include "ui/gfx/geometry/size.h"
14 #include "ui/views/widget/widget_observer.h" 15 #include "ui/views/widget/widget_observer.h"
15 16
16 namespace app_list { 17 namespace app_list {
17 class ApplicationDragAndDropHost; 18 class ApplicationDragAndDropHost;
18 } 19 }
19 20
20 namespace aura { 21 namespace aura {
21 class Window; 22 class Window;
22 } 23 }
23 24
24 namespace gfx { 25 namespace gfx {
25 class Rect; 26 class Rect;
26 } 27 }
27 28
28 namespace views { 29 namespace views {
29 class View; 30 class View;
30 } 31 }
31 32
32 namespace ash { 33 namespace ash {
33 class FocusCycler; 34 class FocusCycler;
34 class ShelfDelegate; 35 class ShelfDelegate;
35 class ShelfIconObserver; 36 class ShelfIconObserver;
36 class ShelfModel; 37 class ShelfModel;
37 class ShelfView; 38 class ShelfView;
38 class ShelfWidget;
39 39
40 namespace test { 40 namespace test {
41 class ShelfTestAPI; 41 class ShelfTestAPI;
42 } 42 }
43 43
44
45 class ASH_EXPORT Shelf { 44 class ASH_EXPORT Shelf {
46 public: 45 public:
47 static const char kNativeViewName[]; 46 static const char kNativeViewName[];
48 47
49 Shelf(ShelfModel* model, ShelfDelegate* delegate, ShelfWidget* widget); 48 Shelf(ShelfModel* model, ShelfDelegate* delegate, ShelfWidget* widget);
50 virtual ~Shelf(); 49 virtual ~Shelf();
51 50
52 // Return the shelf for the primary display. NULL if no user is logged in yet. 51 // Return the shelf for the primary display. NULL if no user is logged in yet.
53 static Shelf* ForPrimaryDisplay(); 52 static Shelf* ForPrimaryDisplay();
54 53
55 // Return the shelf for the display that |window| is currently on, or a shelf 54 // Return the shelf for the display that |window| is currently on, or a shelf
56 // on primary display if the shelf per display feature is disabled. NULL if 55 // on primary display if the shelf per display feature is disabled. NULL if no
57 // no user is logged in yet. 56 // user is logged in yet.
58 static Shelf* ForWindow(aura::Window* window); 57 static Shelf* ForWindow(const aura::Window* window);
59 58
60 void SetAlignment(ShelfAlignment alignment); 59 void SetAlignment(ShelfAlignment alignment);
61 ShelfAlignment alignment() const { return alignment_; } 60 ShelfAlignment alignment() const { return alignment_; }
62 61
63 // Returns the screen bounds of the item for the specified window. If there is 62 // Returns the screen bounds of the item for the specified window. If there is
64 // no item for the specified window an empty rect is returned. 63 // no item for the specified window an empty rect is returned.
65 gfx::Rect GetScreenBoundsOfItemIconForWindow(const aura::Window* window); 64 gfx::Rect GetScreenBoundsOfItemIconForWindow(const aura::Window* window);
66 65
67 // Updates the icon position given the current window bounds. This is used 66 // Updates the icon position given the current window bounds. This is used
68 // when dragging panels to reposition them with respect to the other panels. 67 // when dragging panels to reposition them with respect to the other panels.
(...skipping 19 matching lines...) Expand all
88 87
89 void SchedulePaint(); 88 void SchedulePaint();
90 89
91 views::View* GetAppListButtonView() const; 90 views::View* GetAppListButtonView() const;
92 91
93 // Launch a 0-indexed shelf item in the shelf. 92 // Launch a 0-indexed shelf item in the shelf.
94 // A negative index launches the last shelf item in the shelf. 93 // A negative index launches the last shelf item in the shelf.
95 void LaunchAppIndexAt(int item_index); 94 void LaunchAppIndexAt(int item_index);
96 95
97 ShelfWidget* shelf_widget() { return shelf_widget_; } 96 ShelfWidget* shelf_widget() { return shelf_widget_; }
97 ShelfLayoutManager* shelf_layout_manager() {
sky 2016/02/29 16:38:39 Seems unfortunate that we expose the ShelfLayoutMa
msw 2016/02/29 23:23:44 Agreed; I tackled some low-hanging fruit and added
98 return shelf_widget_->shelf_layout_manager();
99 }
98 100
99 // Set the bounds of the shelf view. 101 // Set the bounds of the shelf view.
100 void SetShelfViewBounds(gfx::Rect bounds); 102 void SetShelfViewBounds(gfx::Rect bounds);
101 gfx::Rect GetShelfViewBounds() const; 103 gfx::Rect GetShelfViewBounds() const;
102 104
103 // Returns rectangle bounding all visible shelf items. Used screen coordinate 105 // Returns rectangle bounding all visible shelf items. Used screen coordinate
104 // system. 106 // system.
105 gfx::Rect GetVisibleItemsBoundsInScreen() const; 107 gfx::Rect GetVisibleItemsBoundsInScreen() const;
106 108
107 // Returns ApplicationDragAndDropHost for this shelf. 109 // Returns ApplicationDragAndDropHost for this shelf.
(...skipping 10 matching lines...) Expand all
118 ShelfDelegate* delegate_; 120 ShelfDelegate* delegate_;
119 121
120 ShelfWidget* shelf_widget_; 122 ShelfWidget* shelf_widget_;
121 123
122 DISALLOW_COPY_AND_ASSIGN(Shelf); 124 DISALLOW_COPY_AND_ASSIGN(Shelf);
123 }; 125 };
124 126
125 } // namespace ash 127 } // namespace ash
126 128
127 #endif // ASH_SHELF_SHELF_H_ 129 #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