OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_LAUNCHER_LAUNCHER_H_ | 5 #ifndef ASH_SHELF_SHELF_H_ |
6 #define ASH_LAUNCHER_LAUNCHER_H_ | 6 #define ASH_SHELF_SHELF_H_ |
7 | 7 |
8 #include "ash/ash_export.h" | 8 #include "ash/ash_export.h" |
9 #include "ash/launcher/launcher_types.h" | 9 #include "ash/launcher/launcher_types.h" |
10 #include "ash/shelf/shelf_types.h" | 10 #include "ash/shelf/shelf_types.h" |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
13 #include "ui/gfx/size.h" | 13 #include "ui/gfx/size.h" |
14 #include "ui/views/widget/widget_observer.h" | 14 #include "ui/views/widget/widget_observer.h" |
15 | 15 |
16 namespace app_list { | 16 namespace app_list { |
(...skipping 14 matching lines...) Expand all Loading... |
31 | 31 |
32 namespace ash { | 32 namespace ash { |
33 | 33 |
34 namespace internal { | 34 namespace internal { |
35 class FocusCycler; | 35 class FocusCycler; |
36 class ShelfLayoutManager; | 36 class ShelfLayoutManager; |
37 class ShelfView; | 37 class ShelfView; |
38 } | 38 } |
39 | 39 |
40 namespace test { | 40 namespace test { |
41 class LauncherTestAPI; | 41 class ShelfTestAPI; |
42 } | 42 } |
43 | 43 |
44 class ShelfDelegate; | 44 class ShelfDelegate; |
45 class ShelfIconObserver; | 45 class ShelfIconObserver; |
46 class ShelfModel; | 46 class ShelfModel; |
47 class ShelfWidget; | 47 class ShelfWidget; |
48 | 48 |
49 class ASH_EXPORT Launcher { | 49 class ASH_EXPORT Shelf { |
50 public: | 50 public: |
51 static const char kNativeViewName[]; | 51 static const char kNativeViewName[]; |
52 | 52 |
53 Launcher(ShelfModel* model, ShelfDelegate* delegate, ShelfWidget* widget); | 53 Shelf(ShelfModel* model, ShelfDelegate* delegate, ShelfWidget* widget); |
54 virtual ~Launcher(); | 54 virtual ~Shelf(); |
55 | 55 |
56 // Return the launcher for the primary display. NULL if no user is | 56 // Return the shelf for the primary display. NULL if no user is logged in yet. |
57 // logged in yet. | 57 static Shelf* ForPrimaryDisplay(); |
58 static Launcher* ForPrimaryDisplay(); | |
59 | 58 |
60 // Return the launcher for the display that |window| is currently on, | 59 // Return the shelf for the display that |window| is currently on, or a shelf |
61 // or a launcher on primary display if the launcher per display feature | 60 // on primary display if the shelf per display feature is disabled. NULL if |
62 // is disabled. NULL if no user is logged in yet. | 61 // no user is logged in yet. |
63 static Launcher* ForWindow(aura::Window* window); | 62 static Shelf* ForWindow(aura::Window* window); |
64 | 63 |
65 void SetAlignment(ShelfAlignment alignment); | 64 void SetAlignment(ShelfAlignment alignment); |
66 ShelfAlignment alignment() const { return alignment_; } | 65 ShelfAlignment alignment() const { return alignment_; } |
67 | 66 |
68 // Returns the screen bounds of the item for the specified window. If there is | 67 // Returns the screen bounds of the item for the specified window. If there is |
69 // no item for the specified window an empty rect is returned. | 68 // no item for the specified window an empty rect is returned. |
70 gfx::Rect GetScreenBoundsOfItemIconForWindow(aura::Window* window); | 69 gfx::Rect GetScreenBoundsOfItemIconForWindow(aura::Window* window); |
71 | 70 |
72 // Updates the icon position given the current window bounds. This is used | 71 // Updates the icon position given the current window bounds. This is used |
73 // when dragging panels to reposition them with respect to the other panels. | 72 // when dragging panels to reposition them with respect to the other panels. |
74 void UpdateIconPositionForWindow(aura::Window* window); | 73 void UpdateIconPositionForWindow(aura::Window* window); |
75 | 74 |
76 // Activates the the launcher item specified by the index in the list | 75 // Activates the the shelf item specified by the index in the list of shelf |
77 // of launcher items. | 76 // items. |
78 void ActivateLauncherItem(int index); | 77 void ActivateShelfItem(int index); |
79 | 78 |
80 // Cycles the window focus linearly over the current launcher items. | 79 // Cycles the window focus linearly over the current shelf items. |
81 void CycleWindowLinear(CycleDirection direction); | 80 void CycleWindowLinear(CycleDirection direction); |
82 | 81 |
83 void AddIconObserver(ShelfIconObserver* observer); | 82 void AddIconObserver(ShelfIconObserver* observer); |
84 void RemoveIconObserver(ShelfIconObserver* observer); | 83 void RemoveIconObserver(ShelfIconObserver* observer); |
85 | 84 |
86 // Returns true if the Launcher is showing a context menu. | 85 // Returns true if the shelf is showing a context menu. |
87 bool IsShowingMenu() const; | 86 bool IsShowingMenu() const; |
88 | 87 |
89 bool IsShowingOverflowBubble() const; | 88 bool IsShowingOverflowBubble() const; |
90 | 89 |
91 void SetVisible(bool visible) const; | 90 void SetVisible(bool visible) const; |
92 bool IsVisible() const; | 91 bool IsVisible() const; |
93 | 92 |
94 void SchedulePaint(); | 93 void SchedulePaint(); |
95 | 94 |
96 views::View* GetAppListButtonView() const; | 95 views::View* GetAppListButtonView() const; |
97 | 96 |
98 // Launch a 0-indexed launcher item in the Launcher. | 97 // Launch a 0-indexed shelf item in the shelf. |
99 // A negative index launches the last launcher item in the launcher. | 98 // A negative index launches the last shelf item in the shelf. |
100 void LaunchAppIndexAt(int item_index); | 99 void LaunchAppIndexAt(int item_index); |
101 | 100 |
102 ShelfWidget* shelf_widget() { return shelf_widget_; } | 101 ShelfWidget* shelf_widget() { return shelf_widget_; } |
103 | 102 |
104 // Set the bounds of the shelf view. | 103 // Set the bounds of the shelf view. |
105 void SetShelfViewBounds(gfx::Rect bounds); | 104 void SetShelfViewBounds(gfx::Rect bounds); |
106 gfx::Rect GetShelfViewBounds() const; | 105 gfx::Rect GetShelfViewBounds() const; |
107 | 106 |
108 // Returns rectangle bounding all visible launcher items. Used screen | 107 // Returns rectangle bounding all visible shelf items. Used screen coordinate |
109 // coordinate system. | 108 // system. |
110 gfx::Rect GetVisibleItemsBoundsInScreen() const; | 109 gfx::Rect GetVisibleItemsBoundsInScreen() const; |
111 | 110 |
112 // Returns ApplicationDragAndDropHost for this Launcher. | 111 // Returns ApplicationDragAndDropHost for this shelf. |
113 app_list::ApplicationDragAndDropHost* GetDragAndDropHostForAppList(); | 112 app_list::ApplicationDragAndDropHost* GetDragAndDropHostForAppList(); |
114 | 113 |
115 private: | 114 private: |
116 friend class ash::test::LauncherTestAPI; | 115 friend class test::ShelfTestAPI; |
117 | 116 |
118 // ShelfView used to display icons. | 117 // ShelfView used to display icons. |
119 internal::ShelfView* shelf_view_; | 118 internal::ShelfView* shelf_view_; |
120 | 119 |
121 ShelfAlignment alignment_; | 120 ShelfAlignment alignment_; |
122 | 121 |
123 ShelfDelegate* delegate_; | 122 ShelfDelegate* delegate_; |
124 | 123 |
125 ShelfWidget* shelf_widget_; | 124 ShelfWidget* shelf_widget_; |
126 | 125 |
127 DISALLOW_COPY_AND_ASSIGN(Launcher); | 126 DISALLOW_COPY_AND_ASSIGN(Shelf); |
128 }; | 127 }; |
129 | 128 |
130 } // namespace ash | 129 } // namespace ash |
131 | 130 |
132 #endif // ASH_LAUNCHER_LAUNCHER_H_ | 131 #endif // ASH_SHELF_SHELF_H_ |
OLD | NEW |