| 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 <memory> | 8 #include <memory> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <utility> | 10 #include <utility> |
| 11 #include <vector> | 11 #include <vector> |
| 12 | 12 |
| 13 #include "ash/common/shelf/ink_drop_button_listener.h" | 13 #include "ash/common/shelf/ink_drop_button_listener.h" |
| 14 #include "ash/common/shelf/shelf_background_animator_observer.h" | |
| 15 #include "ash/common/shelf/shelf_button_pressed_metric_tracker.h" | 14 #include "ash/common/shelf/shelf_button_pressed_metric_tracker.h" |
| 16 #include "ash/common/shelf/shelf_item_delegate.h" | 15 #include "ash/common/shelf/shelf_item_delegate.h" |
| 17 #include "ash/common/shelf/shelf_model_observer.h" | 16 #include "ash/common/shelf/shelf_model_observer.h" |
| 18 #include "ash/common/shelf/shelf_tooltip_manager.h" | 17 #include "ash/common/shelf/shelf_tooltip_manager.h" |
| 19 #include "ash/wm/gestures/shelf_gesture_handler.h" | 18 #include "ash/wm/gestures/shelf_gesture_handler.h" |
| 20 #include "base/macros.h" | 19 #include "base/macros.h" |
| 21 #include "base/observer_list.h" | 20 #include "base/observer_list.h" |
| 22 #include "ui/app_list/views/app_list_drag_and_drop_host.h" | 21 #include "ui/app_list/views/app_list_drag_and_drop_host.h" |
| 23 #include "ui/views/animation/bounds_animator_observer.h" | 22 #include "ui/views/animation/bounds_animator_observer.h" |
| 24 #include "ui/views/animation/ink_drop_state.h" | 23 #include "ui/views/animation/ink_drop_state.h" |
| (...skipping 13 matching lines...) Expand all Loading... |
| 38 class MenuRunner; | 37 class MenuRunner; |
| 39 } | 38 } |
| 40 | 39 |
| 41 namespace ash { | 40 namespace ash { |
| 42 class AppListButton; | 41 class AppListButton; |
| 43 class DragImageView; | 42 class DragImageView; |
| 44 class OverflowBubble; | 43 class OverflowBubble; |
| 45 class OverflowButton; | 44 class OverflowButton; |
| 46 class ScopedTargetRootWindow; | 45 class ScopedTargetRootWindow; |
| 47 class Shelf; | 46 class Shelf; |
| 48 class ShelfBackgroundAnimator; | |
| 49 class ShelfButton; | 47 class ShelfButton; |
| 50 class ShelfDelegate; | 48 class ShelfDelegate; |
| 51 class ShelfIconObserver; | 49 class ShelfIconObserver; |
| 52 class ShelfModel; | 50 class ShelfModel; |
| 53 struct ShelfItem; | 51 struct ShelfItem; |
| 54 class WmShelf; | 52 class WmShelf; |
| 55 | 53 |
| 56 namespace test { | 54 namespace test { |
| 57 class ShelfViewTestAPI; | 55 class ShelfViewTestAPI; |
| 58 } | 56 } |
| 59 | 57 |
| 60 extern const int SHELF_ALIGNMENT_UMA_ENUM_VALUE_BOTTOM; | 58 extern const int SHELF_ALIGNMENT_UMA_ENUM_VALUE_BOTTOM; |
| 61 extern const int SHELF_ALIGNMENT_UMA_ENUM_VALUE_LEFT; | 59 extern const int SHELF_ALIGNMENT_UMA_ENUM_VALUE_LEFT; |
| 62 extern const int SHELF_ALIGNMENT_UMA_ENUM_VALUE_RIGHT; | 60 extern const int SHELF_ALIGNMENT_UMA_ENUM_VALUE_RIGHT; |
| 63 extern const int SHELF_ALIGNMENT_UMA_ENUM_VALUE_COUNT; | 61 extern const int SHELF_ALIGNMENT_UMA_ENUM_VALUE_COUNT; |
| 64 | 62 |
| 65 class ASH_EXPORT ShelfView : public views::View, | 63 class ASH_EXPORT ShelfView : public views::View, |
| 66 public ShelfBackgroundAnimatorObserver, | |
| 67 public ShelfModelObserver, | 64 public ShelfModelObserver, |
| 68 public InkDropButtonListener, | 65 public InkDropButtonListener, |
| 69 public views::ContextMenuController, | 66 public views::ContextMenuController, |
| 70 public views::FocusTraversable, | 67 public views::FocusTraversable, |
| 71 public views::BoundsAnimatorObserver, | 68 public views::BoundsAnimatorObserver, |
| 72 public app_list::ApplicationDragAndDropHost { | 69 public app_list::ApplicationDragAndDropHost { |
| 73 public: | 70 public: |
| 74 ShelfView(ShelfModel* model, | 71 ShelfView(ShelfModel* model, |
| 75 ShelfDelegate* delegate, | 72 ShelfDelegate* delegate, |
| 76 WmShelf* wm_shelf, | 73 WmShelf* wm_shelf, |
| 77 Shelf* shelf, | 74 Shelf* shelf); |
| 78 ShelfBackgroundAnimator* background_animator); | |
| 79 ~ShelfView() override; | 75 ~ShelfView() override; |
| 80 | 76 |
| 81 Shelf* shelf() const { return shelf_; } | 77 Shelf* shelf() const { return shelf_; } |
| 82 WmShelf* wm_shelf() const { return wm_shelf_; } | 78 WmShelf* wm_shelf() const { return wm_shelf_; } |
| 83 ShelfModel* model() const { return model_; } | 79 ShelfModel* model() const { return model_; } |
| 84 | 80 |
| 85 void Init(); | 81 void Init(); |
| 86 | 82 |
| 87 void OnShelfAlignmentChanged(); | 83 void OnShelfAlignmentChanged(); |
| 88 void SchedulePaintForAllButtons(); | 84 void SchedulePaintForAllButtons(); |
| (...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 280 gfx::Size GetPreferredSize() const override; | 276 gfx::Size GetPreferredSize() const override; |
| 281 void OnBoundsChanged(const gfx::Rect& previous_bounds) override; | 277 void OnBoundsChanged(const gfx::Rect& previous_bounds) override; |
| 282 FocusTraversable* GetPaneFocusTraversable() override; | 278 FocusTraversable* GetPaneFocusTraversable() override; |
| 283 void GetAccessibleState(ui::AXViewState* state) override; | 279 void GetAccessibleState(ui::AXViewState* state) override; |
| 284 void ViewHierarchyChanged( | 280 void ViewHierarchyChanged( |
| 285 const ViewHierarchyChangedDetails& details) override; | 281 const ViewHierarchyChangedDetails& details) override; |
| 286 | 282 |
| 287 // Overridden from ui::EventHandler: | 283 // Overridden from ui::EventHandler: |
| 288 void OnGestureEvent(ui::GestureEvent* event) override; | 284 void OnGestureEvent(ui::GestureEvent* event) override; |
| 289 | 285 |
| 290 // ShelfBackgroundAnimatorObserver: | |
| 291 void UpdateShelfItemBackground(int alpha) override; | |
| 292 | |
| 293 // Overridden from ShelfModelObserver: | 286 // Overridden from ShelfModelObserver: |
| 294 void ShelfItemAdded(int model_index) override; | 287 void ShelfItemAdded(int model_index) override; |
| 295 void ShelfItemRemoved(int model_index, ShelfID id) override; | 288 void ShelfItemRemoved(int model_index, ShelfID id) override; |
| 296 void ShelfItemChanged(int model_index, const ShelfItem& old_item) override; | 289 void ShelfItemChanged(int model_index, const ShelfItem& old_item) override; |
| 297 void ShelfItemMoved(int start_index, int target_index) override; | 290 void ShelfItemMoved(int start_index, int target_index) override; |
| 298 void OnSetShelfItemDelegate(ShelfID id, | 291 void OnSetShelfItemDelegate(ShelfID id, |
| 299 ShelfItemDelegate* item_delegate) override; | 292 ShelfItemDelegate* item_delegate) override; |
| 300 | 293 |
| 301 // Overridden from InkDropButtonListener: | 294 // Overridden from InkDropButtonListener: |
| 302 void ButtonPressed(views::Button* sender, | 295 void ButtonPressed(views::Button* sender, |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 468 bool is_repost_event_on_same_item_; | 461 bool is_repost_event_on_same_item_; |
| 469 | 462 |
| 470 // Record the index for the last pressed shelf item. This variable is used to | 463 // Record the index for the last pressed shelf item. This variable is used to |
| 471 // check if a repost event occurs on the same shelf item as previous one. If | 464 // check if a repost event occurs on the same shelf item as previous one. If |
| 472 // so, the repost event should be ignored. | 465 // so, the repost event should be ignored. |
| 473 int last_pressed_index_; | 466 int last_pressed_index_; |
| 474 | 467 |
| 475 // Tracks UMA metrics based on shelf button press actions. | 468 // Tracks UMA metrics based on shelf button press actions. |
| 476 ShelfButtonPressedMetricTracker shelf_button_pressed_metric_tracker_; | 469 ShelfButtonPressedMetricTracker shelf_button_pressed_metric_tracker_; |
| 477 | 470 |
| 478 // The background animator to observe. Can be null. | |
| 479 ShelfBackgroundAnimator* background_animator_; | |
| 480 | |
| 481 DISALLOW_COPY_AND_ASSIGN(ShelfView); | 471 DISALLOW_COPY_AND_ASSIGN(ShelfView); |
| 482 }; | 472 }; |
| 483 | 473 |
| 484 } // namespace ash | 474 } // namespace ash |
| 485 | 475 |
| 486 #endif // ASH_SHELF_SHELF_VIEW_H_ | 476 #endif // ASH_SHELF_SHELF_VIEW_H_ |
| OLD | NEW |