15d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)// Copyright 2013 The Chromium Authors. All rights reserved. 25821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Use of this source code is governed by a BSD-style license that can be 35821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// found in the LICENSE file. 45821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 55d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)#ifndef ASH_SHELF_SHELF_H_ 65d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)#define ASH_SHELF_SHELF_H_ 75821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 85821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "ash/ash_export.h" 95d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)#include "ash/shelf/shelf_constants.h" 102a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#include "ash/shelf/shelf_types.h" 115821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "base/basictypes.h" 125821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "base/memory/scoped_ptr.h" 135821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "ui/gfx/size.h" 142a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles)#include "ui/views/widget/widget_observer.h" 155821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 16bb1529ce867d8845a77ec7cdf3e3003ef1771a40Ben Murdochnamespace app_list { 17bb1529ce867d8845a77ec7cdf3e3003ef1771a40Ben Murdochclass ApplicationDragAndDropHost; 18bb1529ce867d8845a77ec7cdf3e3003ef1771a40Ben Murdoch} 19bb1529ce867d8845a77ec7cdf3e3003ef1771a40Ben Murdoch 205821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)namespace aura { 215821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class Window; 225821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)} 235821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 245821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)namespace gfx { 255821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class Rect; 265821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)} 275821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 285821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)namespace views { 295821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class View; 305821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)} 315821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 325821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)namespace ash { 335821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class FocusCycler; 34c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdochclass ShelfDelegate; 35c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdochclass ShelfIconObserver; 365821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class ShelfLayoutManager; 37c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdochclass ShelfModel; 388bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)class ShelfView; 39c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdochclass ShelfWidget; 405821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 41d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)namespace test { 425d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)class ShelfTestAPI; 43d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles)} 44d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles) 455821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 465d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)class ASH_EXPORT Shelf { 475821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) public: 48c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) static const char kNativeViewName[]; 49c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) 505d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) Shelf(ShelfModel* model, ShelfDelegate* delegate, ShelfWidget* widget); 515d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) virtual ~Shelf(); 525821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 535d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) // Return the shelf for the primary display. NULL if no user is logged in yet. 545d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) static Shelf* ForPrimaryDisplay(); 555821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 565d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) // Return the shelf for the display that |window| is currently on, or a shelf 575d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) // on primary display if the shelf per display feature is disabled. NULL if 585d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) // no user is logged in yet. 595d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) static Shelf* ForWindow(aura::Window* window); 605821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 615821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) void SetAlignment(ShelfAlignment alignment); 625821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) ShelfAlignment alignment() const { return alignment_; } 635821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 645821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Returns the screen bounds of the item for the specified window. If there is 655821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // no item for the specified window an empty rect is returned. 66f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles) gfx::Rect GetScreenBoundsOfItemIconForWindow(const aura::Window* window); 675821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 682a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // Updates the icon position given the current window bounds. This is used 692a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // when dragging panels to reposition them with respect to the other panels. 702a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) void UpdateIconPositionForWindow(aura::Window* window); 712a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 725d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) // Activates the the shelf item specified by the index in the list of shelf 735d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) // items. 745d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) void ActivateShelfItem(int index); 755821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 765d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) // Cycles the window focus linearly over the current shelf items. 775821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) void CycleWindowLinear(CycleDirection direction); 785821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 791e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles) void AddIconObserver(ShelfIconObserver* observer); 801e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles) void RemoveIconObserver(ShelfIconObserver* observer); 815821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 825d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) // Returns true if the shelf is showing a context menu. 835821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) bool IsShowingMenu() const; 845821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 855821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) bool IsShowingOverflowBubble() const; 865821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 875821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) void SetVisible(bool visible) const; 882a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) bool IsVisible() const; 895821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 90ba5b9a6411cb1792fd21f0a078d7a25cd1ceec16Ben Murdoch void SchedulePaint(); 91ba5b9a6411cb1792fd21f0a078d7a25cd1ceec16Ben Murdoch 925821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) views::View* GetAppListButtonView() const; 935821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 945d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) // Launch a 0-indexed shelf item in the shelf. 955d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) // A negative index launches the last shelf item in the shelf. 96eb525c5499e34cc9c4b825d6d9e75bb07cc06aceBen Murdoch void LaunchAppIndexAt(int item_index); 975821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 982a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) ShelfWidget* shelf_widget() { return shelf_widget_; } 995821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 1008bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) // Set the bounds of the shelf view. 1018bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) void SetShelfViewBounds(gfx::Rect bounds); 1028bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) gfx::Rect GetShelfViewBounds() const; 1035821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 1045d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) // Returns rectangle bounding all visible shelf items. Used screen coordinate 1055d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) // system. 1064e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles) gfx::Rect GetVisibleItemsBoundsInScreen() const; 1074e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles) 1085d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) // Returns ApplicationDragAndDropHost for this shelf. 109bb1529ce867d8845a77ec7cdf3e3003ef1771a40Ben Murdoch app_list::ApplicationDragAndDropHost* GetDragAndDropHostForAppList(); 110bb1529ce867d8845a77ec7cdf3e3003ef1771a40Ben Murdoch 1115821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) private: 1125d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) friend class test::ShelfTestAPI; 113d0247b1b59f9c528cb6df88b4f2b9afaf80d181eTorne (Richard Coles) 1148bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) // ShelfView used to display icons. 115c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch ShelfView* shelf_view_; 1165821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 1175821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) ShelfAlignment alignment_; 1185821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 119a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles) ShelfDelegate* delegate_; 1205821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 1212a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) ShelfWidget* shelf_widget_; 1225821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 1235d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) DISALLOW_COPY_AND_ASSIGN(Shelf); 1245821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)}; 1255821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 1265821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)} // namespace ash 1275821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 1285d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)#endif // ASH_SHELF_SHELF_H_ 129