15821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)// Copyright (c) 2012 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) 58bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)#ifndef ASH_SHELF_SHELF_VIEW_H_ 68bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)#define ASH_SHELF_SHELF_VIEW_H_ 75821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 85821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include <utility> 95821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include <vector> 105821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 11f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)#include "ash/shelf/shelf_button_host.h" 12f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)#include "ash/shelf/shelf_model_observer.h" 135821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "ash/wm/gestures/shelf_gesture_handler.h" 145821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "base/observer_list.h" 15b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles)#include "ui/app_list/views/app_list_drag_and_drop_host.h" 165821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "ui/views/animation/bounds_animator_observer.h" 175821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "ui/views/context_menu_controller.h" 185821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "ui/views/controls/button/button.h" 195821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "ui/views/focus/focus_manager.h" 205821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)#include "ui/views/view.h" 215821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 22cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)namespace ui { 23cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)class MenuModel; 24cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles)} 25cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) 265821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)namespace views { 275821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class BoundsAnimator; 285821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class MenuRunner; 295821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class ViewModel; 305821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)} 315821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 325821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)namespace ash { 33a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)class ShelfDelegate; 341e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles)class ShelfIconObserver; 35a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles)class ShelfItemDelegateManager; 36f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)class ShelfModel; 375d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles)struct ShelfItem; 38a93a17c8d99d686bd4a1511e5504e5e6cc9fcadfTorne (Richard Coles)class DragImageView; 395821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class OverflowBubble; 405821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)class OverflowButton; 41f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)class ShelfButton; 424e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)class ShelfLayoutManager; 434e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles)class ShelfTooltipManager; 445821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 45c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdochnamespace test { 46c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdochclass ShelfViewTestAPI; 47c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch} 48c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch 49f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)extern const int SHELF_ALIGNMENT_UMA_ENUM_VALUE_BOTTOM; 50f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)extern const int SHELF_ALIGNMENT_UMA_ENUM_VALUE_LEFT; 51f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)extern const int SHELF_ALIGNMENT_UMA_ENUM_VALUE_RIGHT; 52f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles)extern const int SHELF_ALIGNMENT_UMA_ENUM_VALUE_COUNT; 53f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) 548bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)class ASH_EXPORT ShelfView : public views::View, 55f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) public ShelfModelObserver, 568bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) public views::ButtonListener, 57f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) public ShelfButtonHost, 588bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) public views::ContextMenuController, 598bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) public views::FocusTraversable, 608bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) public views::BoundsAnimatorObserver, 618bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) public app_list::ApplicationDragAndDropHost { 625821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) public: 63f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) ShelfView(ShelfModel* model, 64a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles) ShelfDelegate* delegate, 65a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles) ShelfLayoutManager* manager); 668bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) virtual ~ShelfView(); 675821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 684e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles) ShelfTooltipManager* tooltip_manager() { return tooltip_.get(); } 695821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 701e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles) ShelfLayoutManager* shelf_layout_manager() { return layout_manager_; } 711e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles) 72f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) ShelfModel* model() { return model_; } 732a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 745821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) void Init(); 755821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 762a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) void OnShelfAlignmentChanged(); 77ba5b9a6411cb1792fd21f0a078d7a25cd1ceec16Ben Murdoch void SchedulePaintForAllButtons(); 785821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 795821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Returns the ideal bounds of the specified item, or an empty rect if id 80cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) // isn't know. If the item is in an overflow shelf, the overflow icon location 81cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) // will be returned. 825d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) gfx::Rect GetIdealBoundsOfItemIcon(ShelfID id); 835821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 842a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // Repositions the icon for the specified item by the midpoint of the window. 855d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) void UpdatePanelIconPosition(ShelfID id, const gfx::Point& midpoint); 862a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 871e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles) void AddIconObserver(ShelfIconObserver* observer); 881e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles) void RemoveIconObserver(ShelfIconObserver* observer); 895821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 905821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Returns true if we're showing a menu. 915821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) bool IsShowingMenu() const; 925821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 935821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Returns true if overflow bubble is shown. 945821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) bool IsShowingOverflowBubble() const; 955821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 968bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) // Sets owner overflow bubble instance from which this shelf view pops 974e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles) // out as overflow. 984e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles) void set_owner_overflow_bubble(OverflowBubble* owner) { 994e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles) owner_overflow_bubble_ = owner; 1004e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles) } 1014e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles) 1025821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) views::View* GetAppListButtonView() const; 1035821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 1045821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Returns true if the mouse cursor exits the area for launcher tooltip. 1055821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // There are thin gaps between launcher buttons but the tooltip shouldn't hide 1065821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // in the gaps, but the tooltip should hide if the mouse moved totally outside 1075821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // of the buttons area. 1085821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) bool ShouldHideTooltip(const gfx::Point& cursor_location); 1095821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 1104e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles) // Returns rectangle bounding all visible launcher items. Used screen 1114e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles) // coordinate system. 1124e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles) gfx::Rect GetVisibleItemsBoundsInScreen(); 1134e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles) 1145821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Overridden from FocusTraversable: 1155821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) virtual views::FocusSearch* GetFocusSearch() OVERRIDE; 1165821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) virtual FocusTraversable* GetFocusTraversableParent() OVERRIDE; 1175821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) virtual View* GetFocusTraversableParentView() OVERRIDE; 1185821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 119b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles) // Overridden from app_list::ApplicationDragAndDropHost: 120a93a17c8d99d686bd4a1511e5504e5e6cc9fcadfTorne (Richard Coles) virtual void CreateDragIconProxy( 121a93a17c8d99d686bd4a1511e5504e5e6cc9fcadfTorne (Richard Coles) const gfx::Point& location_in_screen_coordinates, 122a93a17c8d99d686bd4a1511e5504e5e6cc9fcadfTorne (Richard Coles) const gfx::ImageSkia& icon, 123a93a17c8d99d686bd4a1511e5504e5e6cc9fcadfTorne (Richard Coles) views::View* replaced_view, 124868fa2fe829687343ffae624259930155e16dbd8Torne (Richard Coles) const gfx::Vector2d& cursor_offset_from_center, 125a93a17c8d99d686bd4a1511e5504e5e6cc9fcadfTorne (Richard Coles) float scale_factor) OVERRIDE; 126a93a17c8d99d686bd4a1511e5504e5e6cc9fcadfTorne (Richard Coles) virtual void UpdateDragIconProxy( 127a93a17c8d99d686bd4a1511e5504e5e6cc9fcadfTorne (Richard Coles) const gfx::Point& location_in_screen_coordinates) OVERRIDE; 128a93a17c8d99d686bd4a1511e5504e5e6cc9fcadfTorne (Richard Coles) virtual void DestroyDragIconProxy() OVERRIDE; 129b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles) virtual bool StartDrag( 130b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles) const std::string& app_id, 131b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles) const gfx::Point& location_in_screen_coordinates) OVERRIDE; 132b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles) virtual bool Drag(const gfx::Point& location_in_screen_coordinates) OVERRIDE; 133b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles) virtual void EndDrag(bool cancel) OVERRIDE; 134b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles) 135a93a17c8d99d686bd4a1511e5504e5e6cc9fcadfTorne (Richard Coles) // Return the view model for test purposes. 1361320f92c476a1ad9d19dba2a48c72b75566198e9Primiano Tucci const views::ViewModel* view_model_for_test() const { 137a93a17c8d99d686bd4a1511e5504e5e6cc9fcadfTorne (Richard Coles) return view_model_.get(); 138a93a17c8d99d686bd4a1511e5504e5e6cc9fcadfTorne (Richard Coles) } 139a93a17c8d99d686bd4a1511e5504e5e6cc9fcadfTorne (Richard Coles) 1405821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) private: 1418bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) friend class ash::test::ShelfViewTestAPI; 1425821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 1435821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) class FadeOutAnimationDelegate; 1445821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) class StartFadeAnimationDelegate; 1455821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 1465821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) struct IdealBounds { 1475821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) gfx::Rect overflow_bounds; 1485821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) }; 1495821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 150424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles) enum RemovableState { 151424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles) REMOVABLE, // Item can be removed when dragged away. 1521e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles) DRAGGABLE, // Item can be dragged, but will snap always back to origin. 153424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles) NOT_REMOVABLE, // Item is fixed and can never be removed. 154424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles) }; 155424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles) 156f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) // Returns true when this ShelfView is used for Overflow Bubble. 157f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) // In this mode, it does not show app list, panel and overflow button. 158f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) // Note: 159f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) // * When Shelf can contain only one item (overflow button) due to very 160f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) // small resolution screen, overflow bubble can show app list and panel 161f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) // button. 162f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) bool is_overflow_mode() const { return overflow_mode_; } 1635821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 1645821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) bool dragging() const { 1655821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) return drag_pointer_ != NONE; 1665821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) } 1675821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 1685821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Sets the bounds of each view to its ideal bounds. 1695821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) void LayoutToIdealBounds(); 1705821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 171a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles) // Update all button's visibility in overflow. 172a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles) void UpdateAllButtonsVisibilityInOverflowMode(); 173a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles) 1745821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Calculates the ideal bounds. The bounds of each button corresponding to an 1755821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // item in the model is set in |view_model_|. 176cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) void CalculateIdealBounds(IdealBounds* bounds) const; 1775821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 1785821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Returns the index of the last view whose max primary axis coordinate is 1795821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // less than |max_value|. Returns -1 if nothing fits, or there are no views. 1802a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) int DetermineLastVisibleIndex(int max_value) const; 1812a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 1822a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // Returns the index of the first panel whose min primary axis coordinate is 1832a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // at least |min_value|. Returns the index past the last panel if none fit. 1842a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) int DetermineFirstVisiblePanelIndex(int min_value) const; 1855821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 1865821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Animates the bounds of each view to its ideal bounds. 1875821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) void AnimateToIdealBounds(); 1885821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 1895821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Creates the view used to represent |item|. 1905d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) views::View* CreateViewForItem(const ShelfItem& item); 1915821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 1925821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Fades |view| from an opacity of 0 to 1. This is when adding a new item. 1935821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) void FadeIn(views::View* view); 1945821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 1955821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Invoked when the pointer has moved enough to trigger a drag. Sets 1965821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // internal state in preparation for the drag. 1975821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) void PrepareForDrag(Pointer pointer, const ui::LocatedEvent& event); 1985821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 1995821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Invoked when the mouse is dragged. Updates the models as appropriate. 2005821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) void ContinueDrag(const ui::LocatedEvent& event); 2015821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 202424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles) // Handles ripping off an item from the shelf. Returns true when the item got 203424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles) // removed. 204424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles) bool HandleRipOffDrag(const ui::LocatedEvent& event); 205424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles) 206424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles) // Finalize the rip off dragging by either |cancel| the action or validating. 207424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles) void FinalizeRipOffDrag(bool cancel); 208424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles) 209424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles) // Check if an item can be ripped off or not. 210cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) RemovableState RemovableByRipOff(int index) const; 211424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles) 2125821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Returns true if |typea| and |typeb| should be in the same drag range. 2135d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) bool SameDragType(ShelfItemType typea, ShelfItemType typeb) const; 2145821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 2155821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Returns the range (in the model) the item at the specified index can be 2165821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // dragged to. 2175821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) std::pair<int, int> GetDragRange(int index); 2185821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 2195821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // If there is a drag operation in progress it's canceled. If |modified_index| 2205821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // is valid, the new position of the corresponding item is returned. 2215821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) int CancelDrag(int modified_index); 2225821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 223f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) // Returns rectangle bounds used for drag insertion. 224f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) // Note: 225f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) // * When overflow button is visible, returns bounds from first item 226f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) // to overflow button. 227f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) // * When overflow button is visible and one or more panel items exists, 228f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) // returns bounds from first item to last panel item. 229f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) // * In the overflow mode, returns only bubble's bounds. 230f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) gfx::Rect GetBoundsForDragInsertInScreen(); 231f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) 2325821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Common setup done for all children. 2335821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) void ConfigureChildView(views::View* view); 2345821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 2352a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // Toggles the overflow menu. 2362a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) void ToggleOverflowBubble(); 2375821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 2382a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // Invoked after the fading out animation for item deletion is ended. 2392a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) void OnFadeOutAnimationEnded(); 2402a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 2411e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles) // Fade in last visible item. 2421e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles) void StartFadeInLastVisibleItem(); 2431e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles) 2442a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // Updates the visible range of overflow items in |overflow_view|. 245cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) void UpdateOverflowRange(ShelfView* overflow_view) const; 2462a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 2475821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Overridden from views::View: 248cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) virtual gfx::Size GetPreferredSize() const OVERRIDE; 2495821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) virtual void OnBoundsChanged(const gfx::Rect& previous_bounds) OVERRIDE; 2505821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) virtual FocusTraversable* GetPaneFocusTraversable() OVERRIDE; 251a1401311d1ab56c4ed0a474bd38c108f75cb0cd9Torne (Richard Coles) virtual void GetAccessibleState(ui::AXViewState* state) OVERRIDE; 2525821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 2535821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Overridden from ui::EventHandler: 2542a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE; 2555821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 256f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) // Overridden from ShelfModelObserver: 257f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) virtual void ShelfItemAdded(int model_index) OVERRIDE; 2585d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) virtual void ShelfItemRemoved(int model_index, ShelfID id) OVERRIDE; 259f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) virtual void ShelfItemChanged(int model_index, 2605d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) const ShelfItem& old_item) OVERRIDE; 261f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) virtual void ShelfItemMoved(int start_index, int target_index) OVERRIDE; 262f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) virtual void ShelfStatusChanged() OVERRIDE; 263f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) 264f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) // Overridden from ShelfButtonHost: 265f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) virtual void PointerPressedOnButton(views::View* view, 266f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) Pointer pointer, 267f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) const ui::LocatedEvent& event) OVERRIDE; 268f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) virtual void PointerDraggedOnButton(views::View* view, 269f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) Pointer pointer, 270f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) const ui::LocatedEvent& event) OVERRIDE; 2715821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) virtual void PointerReleasedOnButton(views::View* view, 2725821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) Pointer pointer, 2735821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) bool canceled) OVERRIDE; 2745821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) virtual void MouseMovedOverButton(views::View* view) OVERRIDE; 2755821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) virtual void MouseEnteredButton(views::View* view) OVERRIDE; 2765821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) virtual void MouseExitedButton(views::View* view) OVERRIDE; 277c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) virtual base::string16 GetAccessibleName(const views::View* view) OVERRIDE; 2785821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 2795821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Overridden from views::ButtonListener: 2805821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) virtual void ButtonPressed(views::Button* sender, 2815821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) const ui::Event& event) OVERRIDE; 2825821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 2832a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // Show the list of all running items for this |item|. It will return true 2842a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // when the menu was shown and false if there were no possible items to 2852a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // choose from. |source| specifies the view which is responsible for showing 2862a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // the menu, and the bubble will point towards it. 2872a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // The |event_flags| are the flags of the event which triggered this menu. 2885d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) bool ShowListMenuForView(const ShelfItem& item, 2892a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) views::View* source, 2907d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles) const ui::Event& event); 2912a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 2925821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Overridden from views::ContextMenuController: 2935821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) virtual void ShowContextMenuForView(views::View* source, 2947d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles) const gfx::Point& point, 2957d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles) ui::MenuSourceType source_type) OVERRIDE; 2965821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 297cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) // Show either a context or normal click menu of given |menu_model|. 2982a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // If |context_menu| is set, the displayed menu is a context menu and not 2992a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // a menu listing one or more running applications. 3002a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // The |click_point| is only used for |context_menu|'s. 301cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) void ShowMenu(ui::MenuModel* menu_model, 3022a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) views::View* source, 3032a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) const gfx::Point& click_point, 3047d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles) bool context_menu, 3057d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles) ui::MenuSourceType source_type); 3062a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 3075821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Overridden from views::BoundsAnimatorObserver: 3085821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) virtual void OnBoundsAnimatorProgressed( 3095821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) views::BoundsAnimator* animator) OVERRIDE; 3105821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) virtual void OnBoundsAnimatorDone(views::BoundsAnimator* animator) OVERRIDE; 3115821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 3122a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // Returns false if the click which closed the previous menu is the click 3132a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // which triggered this event. 3142a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) bool IsUsableEvent(const ui::Event& event); 3152a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 3162a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // Convenience accessor to model_->items(). 3175d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) const ShelfItem* ShelfItemForView(const views::View* view) const; 3182a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 3192a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // Returns true if a tooltip should be shown for |view|. 3202a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) bool ShouldShowTooltipForView(const views::View* view) const; 3212a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 322424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles) // Get the distance from the given |coordinate| to the closest point on this 323424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles) // launcher/shelf. 324424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles) int CalculateShelfDistance(const gfx::Point& coordinate) const; 325424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles) 3265821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // The model; owned by Launcher. 327f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) ShelfModel* model_; 3285821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 3295821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Delegate; owned by Launcher. 330a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles) ShelfDelegate* delegate_; 3315821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 3325821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Used to manage the set of active launcher buttons. There is a view per 3335821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // item in |model_|. 3345821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) scoped_ptr<views::ViewModel> view_model_; 3355821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 336f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) // Index of first visible launcher item. 3375821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) int first_visible_index_; 3385821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 3395821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Last index of a launcher button that is visible 3405821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // (does not go into overflow). 341cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) mutable int last_visible_index_; 3425821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 3435821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) scoped_ptr<views::BoundsAnimator> bounds_animator_; 3445821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 3455821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) OverflowButton* overflow_button_; 3465821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 3475821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) scoped_ptr<OverflowBubble> overflow_bubble_; 3485821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 3494e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles) OverflowBubble* owner_overflow_bubble_; 3504e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles) 3514e180b6a0b4720a9b8e9e959a882386f690f08ffTorne (Richard Coles) scoped_ptr<ShelfTooltipManager> tooltip_; 3525821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 3535821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Pointer device that initiated the current drag operation. If there is no 3545821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // current dragging operation, this is NONE. 3555821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) Pointer drag_pointer_; 3565821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 3575821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // The view being dragged. This is set immediately when the mouse is pressed. 3585821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // |dragging_| is set only if the mouse is dragged far enough. 3595821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) views::View* drag_view_; 3605821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 361f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles) // Position of the mouse down event in |drag_view_|'s coordinates. 362f8ee788a64d60abd8f2d742a5fdedde054ecd910Torne (Richard Coles) gfx::Point drag_origin_; 3635821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 3645821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Index |drag_view_| was initially at. 3655821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) int start_drag_index_; 3665821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 3675821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Used for the context menu of a particular item. 3685d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) ShelfID context_menu_id_; 3695821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 3705821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) scoped_ptr<views::FocusSearch> focus_search_; 3715821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 372cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) scoped_ptr<ui::MenuModel> context_menu_model_; 373cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) 3745821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) scoped_ptr<views::MenuRunner> launcher_menu_runner_; 3755821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 3761e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles) ObserverList<ShelfIconObserver> observers_; 3775821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 3785821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // Amount content is inset on the left edge (or top edge for vertical 3795821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) // alignment). 3805821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) int leading_inset_; 3815821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 3825821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) ShelfGestureHandler gesture_handler_; 3835821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 3842a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // True when an item being inserted or removed in the model cancels a drag. 3852a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) bool cancelling_drag_model_changed_; 3862a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 3872a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // Index of the last hidden launcher item. If there are no hidden items this 3882a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // will be equal to last_visible_index_ + 1. 389cedac228d2dd51db4b79ea1e72c7f249408ee061Torne (Richard Coles) mutable int last_hidden_index_; 3902a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 3912a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) // The timestamp of the event which closed the last menu - or 0. 3922a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) base::TimeDelta closing_event_time_; 3932a99a7e74a7f215066514fe81d2bfa6639d9edddTorne (Richard Coles) 394c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) // When this object gets deleted while a menu is shown, this pointed 395c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) // element will be set to false. 396c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) bool* got_deleted_; 397c2e0dbddbe15c98d52c4786dac06cb8952a8ae6dTorne (Richard Coles) 3987d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles) // True if a drag and drop operation created/pinned the item in the launcher 3997d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles) // and it needs to be deleted/unpinned again if the operation gets cancelled. 4007d4cd473f85ac64c3747c96c277f9e506a0d2246Torne (Richard Coles) bool drag_and_drop_item_pinned_; 401b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles) 4025d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) // The ShelfItem which is currently used for a drag and a drop operation 403b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles) // or 0 otherwise. 4045d1f7b1de12d16ceb2c938c56701a3e8bfa558f7Torne (Richard Coles) ShelfID drag_and_drop_shelf_id_; 405b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles) 406b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles) // The application ID of the application which we drag and drop. 407b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles) std::string drag_and_drop_app_id_; 408b2df76ea8fec9e32f6f3718986dba0d95315b29cTorne (Richard Coles) 409a93a17c8d99d686bd4a1511e5504e5e6cc9fcadfTorne (Richard Coles) // The original launcher item's size before the dragging operation. 410a93a17c8d99d686bd4a1511e5504e5e6cc9fcadfTorne (Richard Coles) gfx::Size pre_drag_and_drop_size_; 411a93a17c8d99d686bd4a1511e5504e5e6cc9fcadfTorne (Richard Coles) 412a93a17c8d99d686bd4a1511e5504e5e6cc9fcadfTorne (Richard Coles) // The image proxy for drag operations when a drag and drop host exists and 413a93a17c8d99d686bd4a1511e5504e5e6cc9fcadfTorne (Richard Coles) // the item can be dragged outside the app grid. 414c5cede9ae108bb15f6b7a8aea21c7e1fefa2834cBen Murdoch scoped_ptr<ash::DragImageView> drag_image_; 415a93a17c8d99d686bd4a1511e5504e5e6cc9fcadfTorne (Richard Coles) 416a93a17c8d99d686bd4a1511e5504e5e6cc9fcadfTorne (Richard Coles) // The cursor offset to the middle of the dragged item. 417a93a17c8d99d686bd4a1511e5504e5e6cc9fcadfTorne (Richard Coles) gfx::Vector2d drag_image_offset_; 418a93a17c8d99d686bd4a1511e5504e5e6cc9fcadfTorne (Richard Coles) 419a93a17c8d99d686bd4a1511e5504e5e6cc9fcadfTorne (Richard Coles) // The view which gets replaced by our drag icon proxy. 420a93a17c8d99d686bd4a1511e5504e5e6cc9fcadfTorne (Richard Coles) views::View* drag_replaced_view_; 421a93a17c8d99d686bd4a1511e5504e5e6cc9fcadfTorne (Richard Coles) 422424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles) // True when the icon was dragged off the shelf. 423424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles) bool dragged_off_shelf_; 424424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles) 425424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles) // The rip off view when a snap back operation is underway. 426424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles) views::View* snap_back_from_rip_off_view_; 427424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles) 428a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles) // Holds ShelfItemDelegateManager. 429a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles) ShelfItemDelegateManager* item_manager_; 430424c4d7b64af9d0d8fd9624f381f469654d5e3d2Torne (Richard Coles) 4311e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles) // Holds ShelfLayoutManager. 4321e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles) ShelfLayoutManager* layout_manager_; 4331e9bf3e0803691d0a228da41fc608347b6db4340Torne (Richard Coles) 434f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) // True when this ShelfView is used for Overflow Bubble. 435f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) bool overflow_mode_; 436f2477e01787aa58f445919b809d89e252beef54fTorne (Richard Coles) 437a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles) // Holds a pointer to main ShelfView when a ShelfView is in overflow mode. 438a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles) ShelfView* main_shelf_; 439a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles) 440a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles) // True when ripped item from overflow bubble is entered into Shelf. 441a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles) bool dragged_off_from_overflow_to_shelf_; 442a3f6a49ab37290eeeb8db0f41ec0f1cb74a68be7Torne (Richard Coles) 4438bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles) DISALLOW_COPY_AND_ASSIGN(ShelfView); 4445821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)}; 4455821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 4465821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles)} // namespace ash 4475821806d5e7f356e8fa4b058a389a808ea183019Torne (Richard Coles) 4488bcbed890bc3ce4d7a057a8f32cab53fa534672eTorne (Richard Coles)#endif // ASH_SHELF_SHELF_VIEW_H_ 449