Roll tools/swarming_client/ to b61a1802f5ef4bb8c7b81060cc80add47e6cf302.
[chromium-blink-merge.git] / ash / shelf / shelf.h
blob8af315b3ae55014f397e9ab534731698bcb77666
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
3 // found in the LICENSE file.
5 #ifndef ASH_SHELF_SHELF_H_
6 #define ASH_SHELF_SHELF_H_
8 #include "ash/ash_export.h"
9 #include "ash/shelf/shelf_constants.h"
10 #include "ash/shelf/shelf_types.h"
11 #include "base/basictypes.h"
12 #include "base/memory/scoped_ptr.h"
13 #include "ui/gfx/geometry/size.h"
14 #include "ui/views/widget/widget_observer.h"
16 namespace app_list {
17 class ApplicationDragAndDropHost;
20 namespace aura {
21 class Window;
24 namespace gfx {
25 class Rect;
28 namespace views {
29 class View;
32 namespace ash {
33 class FocusCycler;
34 class ShelfDelegate;
35 class ShelfIconObserver;
36 class ShelfLayoutManager;
37 class ShelfModel;
38 class ShelfView;
39 class ShelfWidget;
41 namespace test {
42 class ShelfTestAPI;
46 class ASH_EXPORT Shelf {
47 public:
48 static const char kNativeViewName[];
50 Shelf(ShelfModel* model, ShelfDelegate* delegate, ShelfWidget* widget);
51 virtual ~Shelf();
53 // Return the shelf for the primary display. NULL if no user is logged in yet.
54 static Shelf* ForPrimaryDisplay();
56 // Return the shelf for the display that |window| is currently on, or a shelf
57 // on primary display if the shelf per display feature is disabled. NULL if
58 // no user is logged in yet.
59 static Shelf* ForWindow(aura::Window* window);
61 void SetAlignment(ShelfAlignment alignment);
62 ShelfAlignment alignment() const { return alignment_; }
64 // Returns the screen bounds of the item for the specified window. If there is
65 // no item for the specified window an empty rect is returned.
66 gfx::Rect GetScreenBoundsOfItemIconForWindow(const aura::Window* window);
68 // Updates the icon position given the current window bounds. This is used
69 // when dragging panels to reposition them with respect to the other panels.
70 void UpdateIconPositionForWindow(aura::Window* window);
72 // Activates the the shelf item specified by the index in the list of shelf
73 // items.
74 void ActivateShelfItem(int index);
76 // Cycles the window focus linearly over the current shelf items.
77 void CycleWindowLinear(CycleDirection direction);
79 void AddIconObserver(ShelfIconObserver* observer);
80 void RemoveIconObserver(ShelfIconObserver* observer);
82 // Returns true if the shelf is showing a context menu.
83 bool IsShowingMenu() const;
85 bool IsShowingOverflowBubble() const;
87 void SetVisible(bool visible) const;
88 bool IsVisible() const;
90 void SchedulePaint();
92 views::View* GetAppListButtonView() const;
94 // Launch a 0-indexed shelf item in the shelf.
95 // A negative index launches the last shelf item in the shelf.
96 void LaunchAppIndexAt(int item_index);
98 ShelfWidget* shelf_widget() { return shelf_widget_; }
100 // Set the bounds of the shelf view.
101 void SetShelfViewBounds(gfx::Rect bounds);
102 gfx::Rect GetShelfViewBounds() const;
104 // Returns rectangle bounding all visible shelf items. Used screen coordinate
105 // system.
106 gfx::Rect GetVisibleItemsBoundsInScreen() const;
108 // Returns ApplicationDragAndDropHost for this shelf.
109 app_list::ApplicationDragAndDropHost* GetDragAndDropHostForAppList();
111 private:
112 friend class test::ShelfTestAPI;
114 // ShelfView used to display icons.
115 ShelfView* shelf_view_;
117 ShelfAlignment alignment_;
119 ShelfDelegate* delegate_;
121 ShelfWidget* shelf_widget_;
123 DISALLOW_COPY_AND_ASSIGN(Shelf);
126 } // namespace ash
128 #endif // ASH_SHELF_SHELF_H_