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