| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef ASH_SHELF_SHELF_VIEW_H_ | 5 #ifndef ASH_SHELF_SHELF_VIEW_H_ |
| 6 #define ASH_SHELF_SHELF_VIEW_H_ | 6 #define ASH_SHELF_SHELF_VIEW_H_ |
| 7 | 7 |
| 8 #include <utility> | 8 #include <utility> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 // There are thin gaps between launcher buttons but the tooltip shouldn't hide | 105 // There are thin gaps between launcher buttons but the tooltip shouldn't hide |
| 106 // in the gaps, but the tooltip should hide if the mouse moved totally outside | 106 // in the gaps, but the tooltip should hide if the mouse moved totally outside |
| 107 // of the buttons area. | 107 // of the buttons area. |
| 108 bool ShouldHideTooltip(const gfx::Point& cursor_location); | 108 bool ShouldHideTooltip(const gfx::Point& cursor_location); |
| 109 | 109 |
| 110 // Returns rectangle bounding all visible launcher items. Used screen | 110 // Returns rectangle bounding all visible launcher items. Used screen |
| 111 // coordinate system. | 111 // coordinate system. |
| 112 gfx::Rect GetVisibleItemsBoundsInScreen(); | 112 gfx::Rect GetVisibleItemsBoundsInScreen(); |
| 113 | 113 |
| 114 // Overridden from FocusTraversable: | 114 // Overridden from FocusTraversable: |
| 115 virtual views::FocusSearch* GetFocusSearch() OVERRIDE; | 115 virtual views::FocusSearch* GetFocusSearch() override; |
| 116 virtual FocusTraversable* GetFocusTraversableParent() OVERRIDE; | 116 virtual FocusTraversable* GetFocusTraversableParent() override; |
| 117 virtual View* GetFocusTraversableParentView() OVERRIDE; | 117 virtual View* GetFocusTraversableParentView() override; |
| 118 | 118 |
| 119 // Overridden from app_list::ApplicationDragAndDropHost: | 119 // Overridden from app_list::ApplicationDragAndDropHost: |
| 120 virtual void CreateDragIconProxy( | 120 virtual void CreateDragIconProxy( |
| 121 const gfx::Point& location_in_screen_coordinates, | 121 const gfx::Point& location_in_screen_coordinates, |
| 122 const gfx::ImageSkia& icon, | 122 const gfx::ImageSkia& icon, |
| 123 views::View* replaced_view, | 123 views::View* replaced_view, |
| 124 const gfx::Vector2d& cursor_offset_from_center, | 124 const gfx::Vector2d& cursor_offset_from_center, |
| 125 float scale_factor) OVERRIDE; | 125 float scale_factor) override; |
| 126 virtual void UpdateDragIconProxy( | 126 virtual void UpdateDragIconProxy( |
| 127 const gfx::Point& location_in_screen_coordinates) OVERRIDE; | 127 const gfx::Point& location_in_screen_coordinates) override; |
| 128 virtual void DestroyDragIconProxy() OVERRIDE; | 128 virtual void DestroyDragIconProxy() override; |
| 129 virtual bool StartDrag( | 129 virtual bool StartDrag( |
| 130 const std::string& app_id, | 130 const std::string& app_id, |
| 131 const gfx::Point& location_in_screen_coordinates) OVERRIDE; | 131 const gfx::Point& location_in_screen_coordinates) override; |
| 132 virtual bool Drag(const gfx::Point& location_in_screen_coordinates) OVERRIDE; | 132 virtual bool Drag(const gfx::Point& location_in_screen_coordinates) override; |
| 133 virtual void EndDrag(bool cancel) OVERRIDE; | 133 virtual void EndDrag(bool cancel) override; |
| 134 | 134 |
| 135 // Return the view model for test purposes. | 135 // Return the view model for test purposes. |
| 136 const views::ViewModel* view_model_for_test() const { | 136 const views::ViewModel* view_model_for_test() const { |
| 137 return view_model_.get(); | 137 return view_model_.get(); |
| 138 } | 138 } |
| 139 | 139 |
| 140 private: | 140 private: |
| 141 friend class ash::test::ShelfViewTestAPI; | 141 friend class ash::test::ShelfViewTestAPI; |
| 142 | 142 |
| 143 class FadeOutAnimationDelegate; | 143 class FadeOutAnimationDelegate; |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 238 // Invoked after the fading out animation for item deletion is ended. | 238 // Invoked after the fading out animation for item deletion is ended. |
| 239 void OnFadeOutAnimationEnded(); | 239 void OnFadeOutAnimationEnded(); |
| 240 | 240 |
| 241 // Fade in last visible item. | 241 // Fade in last visible item. |
| 242 void StartFadeInLastVisibleItem(); | 242 void StartFadeInLastVisibleItem(); |
| 243 | 243 |
| 244 // Updates the visible range of overflow items in |overflow_view|. | 244 // Updates the visible range of overflow items in |overflow_view|. |
| 245 void UpdateOverflowRange(ShelfView* overflow_view) const; | 245 void UpdateOverflowRange(ShelfView* overflow_view) const; |
| 246 | 246 |
| 247 // Overridden from views::View: | 247 // Overridden from views::View: |
| 248 virtual gfx::Size GetPreferredSize() const OVERRIDE; | 248 virtual gfx::Size GetPreferredSize() const override; |
| 249 virtual void OnBoundsChanged(const gfx::Rect& previous_bounds) OVERRIDE; | 249 virtual void OnBoundsChanged(const gfx::Rect& previous_bounds) override; |
| 250 virtual FocusTraversable* GetPaneFocusTraversable() OVERRIDE; | 250 virtual FocusTraversable* GetPaneFocusTraversable() override; |
| 251 virtual void GetAccessibleState(ui::AXViewState* state) OVERRIDE; | 251 virtual void GetAccessibleState(ui::AXViewState* state) override; |
| 252 | 252 |
| 253 // Overridden from ui::EventHandler: | 253 // Overridden from ui::EventHandler: |
| 254 virtual void OnGestureEvent(ui::GestureEvent* event) OVERRIDE; | 254 virtual void OnGestureEvent(ui::GestureEvent* event) override; |
| 255 | 255 |
| 256 // Overridden from ShelfModelObserver: | 256 // Overridden from ShelfModelObserver: |
| 257 virtual void ShelfItemAdded(int model_index) OVERRIDE; | 257 virtual void ShelfItemAdded(int model_index) override; |
| 258 virtual void ShelfItemRemoved(int model_index, ShelfID id) OVERRIDE; | 258 virtual void ShelfItemRemoved(int model_index, ShelfID id) override; |
| 259 virtual void ShelfItemChanged(int model_index, | 259 virtual void ShelfItemChanged(int model_index, |
| 260 const ShelfItem& old_item) OVERRIDE; | 260 const ShelfItem& old_item) override; |
| 261 virtual void ShelfItemMoved(int start_index, int target_index) OVERRIDE; | 261 virtual void ShelfItemMoved(int start_index, int target_index) override; |
| 262 virtual void ShelfStatusChanged() OVERRIDE; | 262 virtual void ShelfStatusChanged() override; |
| 263 | 263 |
| 264 // Overridden from ShelfButtonHost: | 264 // Overridden from ShelfButtonHost: |
| 265 virtual void PointerPressedOnButton(views::View* view, | 265 virtual void PointerPressedOnButton(views::View* view, |
| 266 Pointer pointer, | 266 Pointer pointer, |
| 267 const ui::LocatedEvent& event) OVERRIDE; | 267 const ui::LocatedEvent& event) override; |
| 268 virtual void PointerDraggedOnButton(views::View* view, | 268 virtual void PointerDraggedOnButton(views::View* view, |
| 269 Pointer pointer, | 269 Pointer pointer, |
| 270 const ui::LocatedEvent& event) OVERRIDE; | 270 const ui::LocatedEvent& event) override; |
| 271 virtual void PointerReleasedOnButton(views::View* view, | 271 virtual void PointerReleasedOnButton(views::View* view, |
| 272 Pointer pointer, | 272 Pointer pointer, |
| 273 bool canceled) OVERRIDE; | 273 bool canceled) override; |
| 274 virtual void MouseMovedOverButton(views::View* view) OVERRIDE; | 274 virtual void MouseMovedOverButton(views::View* view) override; |
| 275 virtual void MouseEnteredButton(views::View* view) OVERRIDE; | 275 virtual void MouseEnteredButton(views::View* view) override; |
| 276 virtual void MouseExitedButton(views::View* view) OVERRIDE; | 276 virtual void MouseExitedButton(views::View* view) override; |
| 277 virtual base::string16 GetAccessibleName(const views::View* view) OVERRIDE; | 277 virtual base::string16 GetAccessibleName(const views::View* view) override; |
| 278 | 278 |
| 279 // Overridden from views::ButtonListener: | 279 // Overridden from views::ButtonListener: |
| 280 virtual void ButtonPressed(views::Button* sender, | 280 virtual void ButtonPressed(views::Button* sender, |
| 281 const ui::Event& event) OVERRIDE; | 281 const ui::Event& event) override; |
| 282 | 282 |
| 283 // Show the list of all running items for this |item|. It will return true | 283 // Show the list of all running items for this |item|. It will return true |
| 284 // when the menu was shown and false if there were no possible items to | 284 // when the menu was shown and false if there were no possible items to |
| 285 // choose from. |source| specifies the view which is responsible for showing | 285 // choose from. |source| specifies the view which is responsible for showing |
| 286 // the menu, and the bubble will point towards it. | 286 // the menu, and the bubble will point towards it. |
| 287 // The |event_flags| are the flags of the event which triggered this menu. | 287 // The |event_flags| are the flags of the event which triggered this menu. |
| 288 bool ShowListMenuForView(const ShelfItem& item, | 288 bool ShowListMenuForView(const ShelfItem& item, |
| 289 views::View* source, | 289 views::View* source, |
| 290 const ui::Event& event); | 290 const ui::Event& event); |
| 291 | 291 |
| 292 // Overridden from views::ContextMenuController: | 292 // Overridden from views::ContextMenuController: |
| 293 virtual void ShowContextMenuForView(views::View* source, | 293 virtual void ShowContextMenuForView(views::View* source, |
| 294 const gfx::Point& point, | 294 const gfx::Point& point, |
| 295 ui::MenuSourceType source_type) OVERRIDE; | 295 ui::MenuSourceType source_type) override; |
| 296 | 296 |
| 297 // Show either a context or normal click menu of given |menu_model|. | 297 // Show either a context or normal click menu of given |menu_model|. |
| 298 // If |context_menu| is set, the displayed menu is a context menu and not | 298 // If |context_menu| is set, the displayed menu is a context menu and not |
| 299 // a menu listing one or more running applications. | 299 // a menu listing one or more running applications. |
| 300 // The |click_point| is only used for |context_menu|'s. | 300 // The |click_point| is only used for |context_menu|'s. |
| 301 void ShowMenu(ui::MenuModel* menu_model, | 301 void ShowMenu(ui::MenuModel* menu_model, |
| 302 views::View* source, | 302 views::View* source, |
| 303 const gfx::Point& click_point, | 303 const gfx::Point& click_point, |
| 304 bool context_menu, | 304 bool context_menu, |
| 305 ui::MenuSourceType source_type); | 305 ui::MenuSourceType source_type); |
| 306 | 306 |
| 307 // Overridden from views::BoundsAnimatorObserver: | 307 // Overridden from views::BoundsAnimatorObserver: |
| 308 virtual void OnBoundsAnimatorProgressed( | 308 virtual void OnBoundsAnimatorProgressed( |
| 309 views::BoundsAnimator* animator) OVERRIDE; | 309 views::BoundsAnimator* animator) override; |
| 310 virtual void OnBoundsAnimatorDone(views::BoundsAnimator* animator) OVERRIDE; | 310 virtual void OnBoundsAnimatorDone(views::BoundsAnimator* animator) override; |
| 311 | 311 |
| 312 // Returns false if the click which closed the previous menu is the click | 312 // Returns false if the click which closed the previous menu is the click |
| 313 // which triggered this event. | 313 // which triggered this event. |
| 314 bool IsUsableEvent(const ui::Event& event); | 314 bool IsUsableEvent(const ui::Event& event); |
| 315 | 315 |
| 316 // Convenience accessor to model_->items(). | 316 // Convenience accessor to model_->items(). |
| 317 const ShelfItem* ShelfItemForView(const views::View* view) const; | 317 const ShelfItem* ShelfItemForView(const views::View* view) const; |
| 318 | 318 |
| 319 // Returns true if a tooltip should be shown for |view|. | 319 // Returns true if a tooltip should be shown for |view|. |
| 320 bool ShouldShowTooltipForView(const views::View* view) const; | 320 bool ShouldShowTooltipForView(const views::View* view) const; |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 439 | 439 |
| 440 // True when ripped item from overflow bubble is entered into Shelf. | 440 // True when ripped item from overflow bubble is entered into Shelf. |
| 441 bool dragged_off_from_overflow_to_shelf_; | 441 bool dragged_off_from_overflow_to_shelf_; |
| 442 | 442 |
| 443 DISALLOW_COPY_AND_ASSIGN(ShelfView); | 443 DISALLOW_COPY_AND_ASSIGN(ShelfView); |
| 444 }; | 444 }; |
| 445 | 445 |
| 446 } // namespace ash | 446 } // namespace ash |
| 447 | 447 |
| 448 #endif // ASH_SHELF_SHELF_VIEW_H_ | 448 #endif // ASH_SHELF_SHELF_VIEW_H_ |
| OLD | NEW |