Replacing old devtools pillar page with newer one
[chromium-blink-merge.git] / ash / shelf / shelf.h
blob03cc2b0ef8cff2f5f24a11ebcaae01ad51f80871
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/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 {
34 namespace internal {
35 class FocusCycler;
36 class ShelfLayoutManager;
37 class ShelfView;
40 namespace test {
41 class ShelfTestAPI;
44 class ShelfDelegate;
45 class ShelfIconObserver;
46 class ShelfModel;
47 class ShelfWidget;
49 class ASH_EXPORT Shelf {
50 public:
51 static const char kNativeViewName[];
53 Shelf(ShelfModel* model, ShelfDelegate* delegate, ShelfWidget* widget);
54 virtual ~Shelf();
56 // Return the shelf for the primary display. NULL if no user is logged in yet.
57 static Shelf* ForPrimaryDisplay();
59 // Return the shelf for the display that |window| is currently on, or a shelf
60 // on primary display if the shelf per display feature is disabled. NULL if
61 // no user is logged in yet.
62 static Shelf* ForWindow(aura::Window* window);
64 void SetAlignment(ShelfAlignment alignment);
65 ShelfAlignment alignment() const { return alignment_; }
67 // Returns the screen bounds of the item for the specified window. If there is
68 // no item for the specified window an empty rect is returned.
69 gfx::Rect GetScreenBoundsOfItemIconForWindow(aura::Window* window);
71 // Updates the icon position given the current window bounds. This is used
72 // when dragging panels to reposition them with respect to the other panels.
73 void UpdateIconPositionForWindow(aura::Window* window);
75 // Activates the the shelf item specified by the index in the list of shelf
76 // items.
77 void ActivateShelfItem(int index);
79 // Cycles the window focus linearly over the current shelf items.
80 void CycleWindowLinear(CycleDirection direction);
82 void AddIconObserver(ShelfIconObserver* observer);
83 void RemoveIconObserver(ShelfIconObserver* observer);
85 // Returns true if the shelf is showing a context menu.
86 bool IsShowingMenu() const;
88 bool IsShowingOverflowBubble() const;
90 void SetVisible(bool visible) const;
91 bool IsVisible() const;
93 void SchedulePaint();
95 views::View* GetAppListButtonView() const;
97 // Launch a 0-indexed shelf item in the shelf.
98 // A negative index launches the last shelf item in the shelf.
99 void LaunchAppIndexAt(int item_index);
101 ShelfWidget* shelf_widget() { return shelf_widget_; }
103 // Set the bounds of the shelf view.
104 void SetShelfViewBounds(gfx::Rect bounds);
105 gfx::Rect GetShelfViewBounds() const;
107 // Returns rectangle bounding all visible shelf items. Used screen coordinate
108 // system.
109 gfx::Rect GetVisibleItemsBoundsInScreen() const;
111 // Returns ApplicationDragAndDropHost for this shelf.
112 app_list::ApplicationDragAndDropHost* GetDragAndDropHostForAppList();
114 private:
115 friend class test::ShelfTestAPI;
117 // ShelfView used to display icons.
118 internal::ShelfView* shelf_view_;
120 ShelfAlignment alignment_;
122 ShelfDelegate* delegate_;
124 ShelfWidget* shelf_widget_;
126 DISALLOW_COPY_AND_ASSIGN(Shelf);
129 } // namespace ash
131 #endif // ASH_SHELF_SHELF_H_