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 MASH_SHELF_SHELF_VIEW_H_ | 5 #ifndef MASH_SHELF_SHELF_VIEW_H_ |
6 #define MASH_SHELF_SHELF_VIEW_H_ | 6 #define MASH_SHELF_SHELF_VIEW_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <utility> | 9 #include <utility> |
10 #include <vector> | 10 #include <vector> |
11 | 11 |
12 #include "base/macros.h" | 12 #include "base/macros.h" |
13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
14 #include "mash/shelf/shelf_button_host.h" | 14 #include "mash/shelf/shelf_button_host.h" |
15 #include "mash/shelf/shelf_model.h" | 15 #include "mash/shelf/shelf_model.h" |
16 #include "mash/shelf/shelf_model_observer.h" | 16 #include "mash/shelf/shelf_model_observer.h" |
17 #include "mash/shelf/shelf_tooltip_manager.h" | 17 #include "mash/shelf/shelf_tooltip_manager.h" |
18 #include "mash/shelf/shelf_types.h" | 18 #include "mash/shelf/shelf_types.h" |
19 #include "ui/views/animation/bounds_animator_observer.h" | 19 #include "ui/views/animation/bounds_animator_observer.h" |
20 #include "ui/views/context_menu_controller.h" | 20 #include "ui/views/context_menu_controller.h" |
21 #include "ui/views/controls/button/button.h" | 21 #include "ui/views/controls/button/button.h" |
22 #include "ui/views/focus/focus_manager.h" | 22 #include "ui/views/focus/focus_manager.h" |
23 #include "ui/views/view.h" | 23 #include "ui/views/view.h" |
24 #include "ui/views/view_model.h" | 24 #include "ui/views/view_model.h" |
25 | 25 |
26 namespace mojo { | 26 namespace mojo { |
27 class ApplicationImpl; | 27 class Shell; |
28 } | 28 } |
29 | 29 |
30 namespace ui { | 30 namespace ui { |
31 class MenuModel; | 31 class MenuModel; |
32 } | 32 } |
33 | 33 |
34 namespace views { | 34 namespace views { |
35 class BoundsAnimator; | 35 class BoundsAnimator; |
36 class MenuRunner; | 36 class MenuRunner; |
37 } | 37 } |
(...skipping 15 matching lines...) Expand all Loading... |
53 // TODO(msw): Restore missing features and testing from the ash shelf: | 53 // TODO(msw): Restore missing features and testing from the ash shelf: |
54 // Alignment, overflow, applist, drag, background, hiding, pinning, panels, etc. | 54 // Alignment, overflow, applist, drag, background, hiding, pinning, panels, etc. |
55 class ShelfView : public views::View, | 55 class ShelfView : public views::View, |
56 public ShelfModelObserver, | 56 public ShelfModelObserver, |
57 public views::ButtonListener, | 57 public views::ButtonListener, |
58 public ShelfButtonHost, | 58 public ShelfButtonHost, |
59 public views::ContextMenuController, | 59 public views::ContextMenuController, |
60 public views::FocusTraversable, | 60 public views::FocusTraversable, |
61 public views::BoundsAnimatorObserver { | 61 public views::BoundsAnimatorObserver { |
62 public: | 62 public: |
63 explicit ShelfView(mojo::ApplicationImpl* app); | 63 explicit ShelfView(mojo::Shell* shell); |
64 ~ShelfView() override; | 64 ~ShelfView() override; |
65 | 65 |
66 mojo::ApplicationImpl* app() const { return app_; } | 66 mojo::Shell* shell() const { return shell_; } |
67 | 67 |
68 void SetAlignment(ShelfAlignment alignment); | 68 void SetAlignment(ShelfAlignment alignment); |
69 | 69 |
70 void SchedulePaintForAllButtons(); | 70 void SchedulePaintForAllButtons(); |
71 | 71 |
72 // Returns the ideal bounds of the specified item, or an empty rect if id | 72 // Returns the ideal bounds of the specified item, or an empty rect if id |
73 // isn't know. If the item is in an overflow shelf, the overflow icon location | 73 // isn't know. If the item is in an overflow shelf, the overflow icon location |
74 // will be returned. | 74 // will be returned. |
75 gfx::Rect GetIdealBoundsOfItemIcon(ShelfID id); | 75 gfx::Rect GetIdealBoundsOfItemIcon(ShelfID id); |
76 | 76 |
(...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
305 const ShelfItem* ShelfItemForView(const views::View* view) const; | 305 const ShelfItem* ShelfItemForView(const views::View* view) const; |
306 | 306 |
307 // Returns true if a tooltip should be shown for |view|. | 307 // Returns true if a tooltip should be shown for |view|. |
308 bool ShouldShowTooltipForView(const views::View* view) const; | 308 bool ShouldShowTooltipForView(const views::View* view) const; |
309 | 309 |
310 // Get the distance from the given |coordinate| to the closest point on this | 310 // Get the distance from the given |coordinate| to the closest point on this |
311 // launcher/shelf. | 311 // launcher/shelf. |
312 int CalculateShelfDistance(const gfx::Point& coordinate) const; | 312 int CalculateShelfDistance(const gfx::Point& coordinate) const; |
313 | 313 |
314 // The shelf application instance. | 314 // The shelf application instance. |
315 mojo::ApplicationImpl* app_; | 315 mojo::Shell* shell_; |
316 | 316 |
317 // The shelf model. | 317 // The shelf model. |
318 ShelfModel model_; | 318 ShelfModel model_; |
319 | 319 |
320 ShelfAlignment alignment_; | 320 ShelfAlignment alignment_; |
321 | 321 |
322 // Used to manage the set of active launcher buttons. There is a view per | 322 // Used to manage the set of active launcher buttons. There is a view per |
323 // item in |model_|. | 323 // item in |model_|. |
324 views::ViewModel view_model_; | 324 views::ViewModel view_model_; |
325 | 325 |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
445 // Tracks UMA metrics based on shelf button press actions. | 445 // Tracks UMA metrics based on shelf button press actions. |
446 ShelfButtonPressedMetricTracker shelf_button_pressed_metric_tracker_;*/ | 446 ShelfButtonPressedMetricTracker shelf_button_pressed_metric_tracker_;*/ |
447 | 447 |
448 DISALLOW_COPY_AND_ASSIGN(ShelfView); | 448 DISALLOW_COPY_AND_ASSIGN(ShelfView); |
449 }; | 449 }; |
450 | 450 |
451 } // namespace shelf | 451 } // namespace shelf |
452 } // namespace mash | 452 } // namespace mash |
453 | 453 |
454 #endif // MASH_SHELF_SHELF_VIEW_H_ | 454 #endif // MASH_SHELF_SHELF_VIEW_H_ |
OLD | NEW |