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_COMMON_SHELF_SHELF_VIEW_H_ |
6 #define ASH_SHELF_SHELF_VIEW_H_ | 6 #define ASH_COMMON_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_button_pressed_metric_tracker.h" | 14 #include "ash/common/shelf/shelf_button_pressed_metric_tracker.h" |
15 #include "ash/common/shelf/shelf_item_delegate.h" | 15 #include "ash/common/shelf/shelf_item_delegate.h" |
16 #include "ash/common/shelf/shelf_model_observer.h" | 16 #include "ash/common/shelf/shelf_model_observer.h" |
(...skipping 18 matching lines...) Expand all Loading... |
35 class MenuModelAdapter; | 35 class MenuModelAdapter; |
36 class MenuRunner; | 36 class MenuRunner; |
37 } | 37 } |
38 | 38 |
39 namespace ash { | 39 namespace ash { |
40 class AppListButton; | 40 class AppListButton; |
41 class DragImageView; | 41 class DragImageView; |
42 class OverflowBubble; | 42 class OverflowBubble; |
43 class OverflowButton; | 43 class OverflowButton; |
44 class ScopedRootWindowForNewWindows; | 44 class ScopedRootWindowForNewWindows; |
45 class Shelf; | |
46 class ShelfButton; | 45 class ShelfButton; |
47 class ShelfDelegate; | 46 class ShelfDelegate; |
48 class ShelfIconObserver; | 47 class ShelfIconObserver; |
49 class ShelfModel; | 48 class ShelfModel; |
50 struct ShelfItem; | 49 struct ShelfItem; |
| 50 class ShelfWidget; |
51 class WmShelf; | 51 class WmShelf; |
52 | 52 |
53 namespace test { | 53 namespace test { |
54 class ShelfViewTestAPI; | 54 class ShelfViewTestAPI; |
55 } | 55 } |
56 | 56 |
57 extern const int SHELF_ALIGNMENT_UMA_ENUM_VALUE_BOTTOM; | 57 extern const int SHELF_ALIGNMENT_UMA_ENUM_VALUE_BOTTOM; |
58 extern const int SHELF_ALIGNMENT_UMA_ENUM_VALUE_LEFT; | 58 extern const int SHELF_ALIGNMENT_UMA_ENUM_VALUE_LEFT; |
59 extern const int SHELF_ALIGNMENT_UMA_ENUM_VALUE_RIGHT; | 59 extern const int SHELF_ALIGNMENT_UMA_ENUM_VALUE_RIGHT; |
60 extern const int SHELF_ALIGNMENT_UMA_ENUM_VALUE_COUNT; | 60 extern const int SHELF_ALIGNMENT_UMA_ENUM_VALUE_COUNT; |
61 | 61 |
62 class ASH_EXPORT ShelfView : public views::View, | 62 class ASH_EXPORT ShelfView : public views::View, |
63 public ShelfModelObserver, | 63 public ShelfModelObserver, |
64 public InkDropButtonListener, | 64 public InkDropButtonListener, |
65 public views::ContextMenuController, | 65 public views::ContextMenuController, |
66 public views::FocusTraversable, | 66 public views::FocusTraversable, |
67 public views::BoundsAnimatorObserver, | 67 public views::BoundsAnimatorObserver, |
68 public app_list::ApplicationDragAndDropHost { | 68 public app_list::ApplicationDragAndDropHost { |
69 public: | 69 public: |
70 ShelfView(ShelfModel* model, | 70 ShelfView(ShelfModel* model, |
71 ShelfDelegate* delegate, | 71 ShelfDelegate* delegate, |
72 WmShelf* wm_shelf, | 72 WmShelf* wm_shelf, |
73 Shelf* shelf); | 73 ShelfWidget* shelf_widget); |
74 ~ShelfView() override; | 74 ~ShelfView() override; |
75 | 75 |
76 Shelf* shelf() const { return shelf_; } | |
77 WmShelf* wm_shelf() const { return wm_shelf_; } | 76 WmShelf* wm_shelf() const { return wm_shelf_; } |
78 ShelfModel* model() const { return model_; } | 77 ShelfModel* model() const { return model_; } |
79 | 78 |
80 void Init(); | 79 void Init(); |
81 | 80 |
82 void OnShelfAlignmentChanged(); | 81 void OnShelfAlignmentChanged(); |
83 void SchedulePaintForAllButtons(); | 82 void SchedulePaintForAllButtons(); |
84 | 83 |
85 // Returns the ideal bounds of the specified item, or an empty rect if id | 84 // Returns the ideal bounds of the specified item, or an empty rect if id |
86 // isn't know. If the item is in an overflow shelf, the overflow icon location | 85 // isn't know. If the item is in an overflow shelf, the overflow icon location |
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
345 | 344 |
346 // The model; owned by Launcher. | 345 // The model; owned by Launcher. |
347 ShelfModel* model_; | 346 ShelfModel* model_; |
348 | 347 |
349 // Delegate; owned by Launcher. | 348 // Delegate; owned by Launcher. |
350 ShelfDelegate* delegate_; | 349 ShelfDelegate* delegate_; |
351 | 350 |
352 // The shelf controller; owned by RootWindowController. | 351 // The shelf controller; owned by RootWindowController. |
353 WmShelf* wm_shelf_; | 352 WmShelf* wm_shelf_; |
354 | 353 |
355 // The shelf; owned by ShelfWidget. | 354 // The shelf widget for this view. For overflow bubbles, this is the widget |
356 Shelf* shelf_; | 355 // for the shelf, not for the bubble. |
| 356 ShelfWidget* shelf_widget_; |
357 | 357 |
358 // Used to manage the set of active launcher buttons. There is a view per | 358 // Used to manage the set of active launcher buttons. There is a view per |
359 // item in |model_|. | 359 // item in |model_|. |
360 std::unique_ptr<views::ViewModel> view_model_; | 360 std::unique_ptr<views::ViewModel> view_model_; |
361 | 361 |
362 // Index of first visible launcher item. | 362 // Index of first visible launcher item. |
363 int first_visible_index_; | 363 int first_visible_index_; |
364 | 364 |
365 // Last index of a launcher button that is visible | 365 // Last index of a launcher button that is visible |
366 // (does not go into overflow). | 366 // (does not go into overflow). |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
467 int last_pressed_index_; | 467 int last_pressed_index_; |
468 | 468 |
469 // Tracks UMA metrics based on shelf button press actions. | 469 // Tracks UMA metrics based on shelf button press actions. |
470 ShelfButtonPressedMetricTracker shelf_button_pressed_metric_tracker_; | 470 ShelfButtonPressedMetricTracker shelf_button_pressed_metric_tracker_; |
471 | 471 |
472 DISALLOW_COPY_AND_ASSIGN(ShelfView); | 472 DISALLOW_COPY_AND_ASSIGN(ShelfView); |
473 }; | 473 }; |
474 | 474 |
475 } // namespace ash | 475 } // namespace ash |
476 | 476 |
477 #endif // ASH_SHELF_SHELF_VIEW_H_ | 477 #endif // ASH_COMMON_SHELF_SHELF_VIEW_H_ |
OLD | NEW |