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> |
(...skipping 25 matching lines...) Expand all Loading... |
36 class MenuModelAdapter; | 36 class MenuModelAdapter; |
37 class MenuRunner; | 37 class MenuRunner; |
38 } | 38 } |
39 | 39 |
40 namespace ash { | 40 namespace ash { |
41 class AppListButton; | 41 class AppListButton; |
42 class DragImageView; | 42 class DragImageView; |
43 class OverflowBubble; | 43 class OverflowBubble; |
44 class OverflowButton; | 44 class OverflowButton; |
45 class ScopedRootWindowForNewWindows; | 45 class ScopedRootWindowForNewWindows; |
| 46 class Shelf; |
46 class ShelfButton; | 47 class ShelfButton; |
47 class ShelfModel; | 48 class ShelfModel; |
48 struct ShelfItem; | 49 struct ShelfItem; |
49 class ShelfWidget; | 50 class ShelfWidget; |
50 class WmShelf; | |
51 | 51 |
52 namespace test { | 52 namespace test { |
53 class ShelfViewTestAPI; | 53 class ShelfViewTestAPI; |
54 } | 54 } |
55 | 55 |
56 enum ShelfAlignmentUmaEnumValue { | 56 enum ShelfAlignmentUmaEnumValue { |
57 SHELF_ALIGNMENT_UMA_ENUM_VALUE_BOTTOM, | 57 SHELF_ALIGNMENT_UMA_ENUM_VALUE_BOTTOM, |
58 SHELF_ALIGNMENT_UMA_ENUM_VALUE_LEFT, | 58 SHELF_ALIGNMENT_UMA_ENUM_VALUE_LEFT, |
59 SHELF_ALIGNMENT_UMA_ENUM_VALUE_RIGHT, | 59 SHELF_ALIGNMENT_UMA_ENUM_VALUE_RIGHT, |
60 // Must be last entry in enum. | 60 // Must be last entry in enum. |
61 SHELF_ALIGNMENT_UMA_ENUM_VALUE_COUNT, | 61 SHELF_ALIGNMENT_UMA_ENUM_VALUE_COUNT, |
62 }; | 62 }; |
63 | 63 |
64 class ASH_EXPORT ShelfView : public views::View, | 64 class ASH_EXPORT ShelfView : public views::View, |
65 public ShelfModelObserver, | 65 public ShelfModelObserver, |
66 public InkDropButtonListener, | 66 public InkDropButtonListener, |
67 public views::ContextMenuController, | 67 public views::ContextMenuController, |
68 public views::FocusTraversable, | 68 public views::FocusTraversable, |
69 public views::BoundsAnimatorObserver, | 69 public views::BoundsAnimatorObserver, |
70 public app_list::ApplicationDragAndDropHost { | 70 public app_list::ApplicationDragAndDropHost { |
71 public: | 71 public: |
72 ShelfView(ShelfModel* model, | 72 ShelfView(ShelfModel* model, Shelf* shelf, ShelfWidget* shelf_widget); |
73 WmShelf* wm_shelf, | |
74 ShelfWidget* shelf_widget); | |
75 ~ShelfView() override; | 73 ~ShelfView() override; |
76 | 74 |
77 WmShelf* wm_shelf() const { return wm_shelf_; } | 75 Shelf* shelf() const { return shelf_; } |
78 ShelfModel* model() const { return model_; } | 76 ShelfModel* model() const { return model_; } |
79 | 77 |
80 void Init(); | 78 void Init(); |
81 | 79 |
82 void OnShelfAlignmentChanged(); | 80 void OnShelfAlignmentChanged(); |
83 | 81 |
84 // Returns the ideal bounds of the specified item, or an empty rect if id | 82 // Returns the ideal bounds of the specified item, or an empty rect if id |
85 // isn't know. If the item is in an overflow shelf, the overflow icon location | 83 // isn't know. If the item is in an overflow shelf, the overflow icon location |
86 // will be returned. | 84 // will be returned. |
87 gfx::Rect GetIdealBoundsOfItemIcon(const ShelfID& id); | 85 gfx::Rect GetIdealBoundsOfItemIcon(const ShelfID& id); |
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
351 // Get the distance from the given |coordinate| to the closest point on this | 349 // Get the distance from the given |coordinate| to the closest point on this |
352 // launcher/shelf. | 350 // launcher/shelf. |
353 int CalculateShelfDistance(const gfx::Point& coordinate) const; | 351 int CalculateShelfDistance(const gfx::Point& coordinate) const; |
354 | 352 |
355 bool CanPrepareForDrag(Pointer pointer, const ui::LocatedEvent& event); | 353 bool CanPrepareForDrag(Pointer pointer, const ui::LocatedEvent& event); |
356 | 354 |
357 // The model; owned by Launcher. | 355 // The model; owned by Launcher. |
358 ShelfModel* model_; | 356 ShelfModel* model_; |
359 | 357 |
360 // The shelf controller; owned by RootWindowController. | 358 // The shelf controller; owned by RootWindowController. |
361 WmShelf* wm_shelf_; | 359 Shelf* shelf_; |
362 | 360 |
363 // The shelf widget for this view. For overflow bubbles, this is the widget | 361 // The shelf widget for this view. For overflow bubbles, this is the widget |
364 // for the shelf, not for the bubble. | 362 // for the shelf, not for the bubble. |
365 ShelfWidget* shelf_widget_; | 363 ShelfWidget* shelf_widget_; |
366 | 364 |
367 // Used to manage the set of active launcher buttons. There is a view per | 365 // Used to manage the set of active launcher buttons. There is a view per |
368 // item in |model_|. | 366 // item in |model_|. |
369 std::unique_ptr<views::ViewModel> view_model_; | 367 std::unique_ptr<views::ViewModel> view_model_; |
370 | 368 |
371 // Index of first visible launcher item. | 369 // Index of first visible launcher item. |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
475 ShelfButtonPressedMetricTracker shelf_button_pressed_metric_tracker_; | 473 ShelfButtonPressedMetricTracker shelf_button_pressed_metric_tracker_; |
476 | 474 |
477 base::WeakPtrFactory<ShelfView> weak_factory_; | 475 base::WeakPtrFactory<ShelfView> weak_factory_; |
478 | 476 |
479 DISALLOW_COPY_AND_ASSIGN(ShelfView); | 477 DISALLOW_COPY_AND_ASSIGN(ShelfView); |
480 }; | 478 }; |
481 | 479 |
482 } // namespace ash | 480 } // namespace ash |
483 | 481 |
484 #endif // ASH_SHELF_SHELF_VIEW_H_ | 482 #endif // ASH_SHELF_SHELF_VIEW_H_ |
OLD | NEW |