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 26 matching lines...) Expand all Loading... |
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 ShelfButton; | 46 class ShelfButton; |
47 class ShelfDelegate; | |
48 class ShelfModel; | 47 class ShelfModel; |
49 struct ShelfItem; | 48 struct ShelfItem; |
50 class ShelfWidget; | 49 class ShelfWidget; |
51 class WmShelf; | 50 class WmShelf; |
52 | 51 |
53 namespace test { | 52 namespace test { |
54 class ShelfViewTestAPI; | 53 class ShelfViewTestAPI; |
55 } | 54 } |
56 | 55 |
57 enum ShelfAlignmentUmaEnumValue { | 56 enum ShelfAlignmentUmaEnumValue { |
58 SHELF_ALIGNMENT_UMA_ENUM_VALUE_BOTTOM, | 57 SHELF_ALIGNMENT_UMA_ENUM_VALUE_BOTTOM, |
59 SHELF_ALIGNMENT_UMA_ENUM_VALUE_LEFT, | 58 SHELF_ALIGNMENT_UMA_ENUM_VALUE_LEFT, |
60 SHELF_ALIGNMENT_UMA_ENUM_VALUE_RIGHT, | 59 SHELF_ALIGNMENT_UMA_ENUM_VALUE_RIGHT, |
61 // Must be last entry in enum. | 60 // Must be last entry in enum. |
62 SHELF_ALIGNMENT_UMA_ENUM_VALUE_COUNT, | 61 SHELF_ALIGNMENT_UMA_ENUM_VALUE_COUNT, |
63 }; | 62 }; |
64 | 63 |
65 class ASH_EXPORT ShelfView : public views::View, | 64 class ASH_EXPORT ShelfView : public views::View, |
66 public ShelfModelObserver, | 65 public ShelfModelObserver, |
67 public InkDropButtonListener, | 66 public InkDropButtonListener, |
68 public views::ContextMenuController, | 67 public views::ContextMenuController, |
69 public views::FocusTraversable, | 68 public views::FocusTraversable, |
70 public views::BoundsAnimatorObserver, | 69 public views::BoundsAnimatorObserver, |
71 public app_list::ApplicationDragAndDropHost { | 70 public app_list::ApplicationDragAndDropHost { |
72 public: | 71 public: |
73 ShelfView(ShelfModel* model, | 72 ShelfView(ShelfModel* model, |
74 ShelfDelegate* delegate, | |
75 WmShelf* wm_shelf, | 73 WmShelf* wm_shelf, |
76 ShelfWidget* shelf_widget); | 74 ShelfWidget* shelf_widget); |
77 ~ShelfView() override; | 75 ~ShelfView() override; |
78 | 76 |
79 WmShelf* wm_shelf() const { return wm_shelf_; } | 77 WmShelf* wm_shelf() const { return wm_shelf_; } |
80 ShelfModel* model() const { return model_; } | 78 ShelfModel* model() const { return model_; } |
81 | 79 |
82 void Init(); | 80 void Init(); |
83 | 81 |
84 void OnShelfAlignmentChanged(); | 82 void OnShelfAlignmentChanged(); |
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
345 // Convenience accessor to model_->items(). | 343 // Convenience accessor to model_->items(). |
346 const ShelfItem* ShelfItemForView(const views::View* view) const; | 344 const ShelfItem* ShelfItemForView(const views::View* view) const; |
347 | 345 |
348 // Get the distance from the given |coordinate| to the closest point on this | 346 // Get the distance from the given |coordinate| to the closest point on this |
349 // launcher/shelf. | 347 // launcher/shelf. |
350 int CalculateShelfDistance(const gfx::Point& coordinate) const; | 348 int CalculateShelfDistance(const gfx::Point& coordinate) const; |
351 | 349 |
352 // The model; owned by Launcher. | 350 // The model; owned by Launcher. |
353 ShelfModel* model_; | 351 ShelfModel* model_; |
354 | 352 |
355 // Delegate; owned by Launcher. | |
356 ShelfDelegate* delegate_; | |
357 | |
358 // The shelf controller; owned by RootWindowController. | 353 // The shelf controller; owned by RootWindowController. |
359 WmShelf* wm_shelf_; | 354 WmShelf* wm_shelf_; |
360 | 355 |
361 // The shelf widget for this view. For overflow bubbles, this is the widget | 356 // The shelf widget for this view. For overflow bubbles, this is the widget |
362 // for the shelf, not for the bubble. | 357 // for the shelf, not for the bubble. |
363 ShelfWidget* shelf_widget_; | 358 ShelfWidget* shelf_widget_; |
364 | 359 |
365 // Used to manage the set of active launcher buttons. There is a view per | 360 // Used to manage the set of active launcher buttons. There is a view per |
366 // item in |model_|. | 361 // item in |model_|. |
367 std::unique_ptr<views::ViewModel> view_model_; | 362 std::unique_ptr<views::ViewModel> view_model_; |
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
471 ShelfButtonPressedMetricTracker shelf_button_pressed_metric_tracker_; | 466 ShelfButtonPressedMetricTracker shelf_button_pressed_metric_tracker_; |
472 | 467 |
473 base::WeakPtrFactory<ShelfView> weak_factory_; | 468 base::WeakPtrFactory<ShelfView> weak_factory_; |
474 | 469 |
475 DISALLOW_COPY_AND_ASSIGN(ShelfView); | 470 DISALLOW_COPY_AND_ASSIGN(ShelfView); |
476 }; | 471 }; |
477 | 472 |
478 } // namespace ash | 473 } // namespace ash |
479 | 474 |
480 #endif // ASH_SHELF_SHELF_VIEW_H_ | 475 #endif // ASH_SHELF_SHELF_VIEW_H_ |
OLD | NEW |