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