Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(38)

Side by Side Diff: ash/shelf/shelf_view.h

Issue 1743493002: Cleanup ash shelf accessor functions. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Revert ash/shelf/shelf_widget.cc for browser_tests crash... Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ash/shelf/shelf_tooltip_manager.cc ('k') | ash/shelf/shelf_view.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <string> 8 #include <string>
9 #include <utility> 9 #include <utility>
10 #include <vector> 10 #include <vector>
(...skipping 16 matching lines...) Expand all
27 namespace ui { 27 namespace ui {
28 class MenuModel; 28 class MenuModel;
29 } 29 }
30 30
31 namespace views { 31 namespace views {
32 class BoundsAnimator; 32 class BoundsAnimator;
33 class MenuRunner; 33 class MenuRunner;
34 } 34 }
35 35
36 namespace ash { 36 namespace ash {
37 class Shelf;
37 class ShelfDelegate; 38 class ShelfDelegate;
38 class ShelfIconObserver; 39 class ShelfIconObserver;
39 class ShelfItemDelegateManager; 40 class ShelfItemDelegateManager;
40 class ShelfModel; 41 class ShelfModel;
41 struct ShelfItem; 42 struct ShelfItem;
42 class DragImageView; 43 class DragImageView;
43 class OverflowBubble; 44 class OverflowBubble;
44 class OverflowButton; 45 class OverflowButton;
45 class ShelfButton; 46 class ShelfButton;
46 class ShelfLayoutManager;
47 class ShelfTooltipManager; 47 class ShelfTooltipManager;
48 48
49 namespace test { 49 namespace test {
50 class ShelfViewTestAPI; 50 class ShelfViewTestAPI;
51 } 51 }
52 52
53 extern const int SHELF_ALIGNMENT_UMA_ENUM_VALUE_BOTTOM; 53 extern const int SHELF_ALIGNMENT_UMA_ENUM_VALUE_BOTTOM;
54 extern const int SHELF_ALIGNMENT_UMA_ENUM_VALUE_LEFT; 54 extern const int SHELF_ALIGNMENT_UMA_ENUM_VALUE_LEFT;
55 extern const int SHELF_ALIGNMENT_UMA_ENUM_VALUE_RIGHT; 55 extern const int SHELF_ALIGNMENT_UMA_ENUM_VALUE_RIGHT;
56 extern const int SHELF_ALIGNMENT_UMA_ENUM_VALUE_COUNT; 56 extern const int SHELF_ALIGNMENT_UMA_ENUM_VALUE_COUNT;
57 57
58 class ASH_EXPORT ShelfView : public views::View, 58 class ASH_EXPORT ShelfView : public views::View,
59 public ShelfModelObserver, 59 public ShelfModelObserver,
60 public views::ButtonListener, 60 public views::ButtonListener,
61 public ShelfButtonHost, 61 public ShelfButtonHost,
62 public views::ContextMenuController, 62 public views::ContextMenuController,
63 public views::FocusTraversable, 63 public views::FocusTraversable,
64 public views::BoundsAnimatorObserver, 64 public views::BoundsAnimatorObserver,
65 public app_list::ApplicationDragAndDropHost { 65 public app_list::ApplicationDragAndDropHost {
66 public: 66 public:
67 ShelfView(ShelfModel* model, 67 ShelfView(ShelfModel* model, ShelfDelegate* delegate, Shelf* shelf);
68 ShelfDelegate* delegate,
69 ShelfLayoutManager* manager);
70 ~ShelfView() override; 68 ~ShelfView() override;
71 69
72 ShelfTooltipManager* tooltip_manager() { return tooltip_.get(); } 70 ShelfTooltipManager* tooltip_manager() { return tooltip_.get(); }
73 71
74 ShelfLayoutManager* shelf_layout_manager() { return layout_manager_; } 72 Shelf* shelf() const { return shelf_; }
75 73 ShelfModel* model() const { return model_; }
76 ShelfModel* model() { return model_; }
77 74
78 void Init(); 75 void Init();
79 76
80 void OnShelfAlignmentChanged(); 77 void OnShelfAlignmentChanged();
81 void SchedulePaintForAllButtons(); 78 void SchedulePaintForAllButtons();
82 79
83 // Returns the ideal bounds of the specified item, or an empty rect if id 80 // Returns the ideal bounds of the specified item, or an empty rect if id
84 // isn't know. If the item is in an overflow shelf, the overflow icon location 81 // isn't know. If the item is in an overflow shelf, the overflow icon location
85 // will be returned. 82 // will be returned.
86 gfx::Rect GetIdealBoundsOfItemIcon(ShelfID id); 83 gfx::Rect GetIdealBoundsOfItemIcon(ShelfID id);
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 }; 153 };
157 154
158 // Returns true when this ShelfView is used for Overflow Bubble. 155 // Returns true when this ShelfView is used for Overflow Bubble.
159 // In this mode, it does not show app list, panel and overflow button. 156 // In this mode, it does not show app list, panel and overflow button.
160 // Note: 157 // Note:
161 // * When Shelf can contain only one item (overflow button) due to very 158 // * When Shelf can contain only one item (overflow button) due to very
162 // small resolution screen, overflow bubble can show app list and panel 159 // small resolution screen, overflow bubble can show app list and panel
163 // button. 160 // button.
164 bool is_overflow_mode() const { return overflow_mode_; } 161 bool is_overflow_mode() const { return overflow_mode_; }
165 162
166 bool dragging() const { 163 bool dragging() const { return drag_pointer_ != NONE; }
167 return drag_pointer_ != NONE;
168 }
169 164
170 // Sets the bounds of each view to its ideal bounds. 165 // Sets the bounds of each view to its ideal bounds.
171 void LayoutToIdealBounds(); 166 void LayoutToIdealBounds();
172 167
173 // Update all button's visibility in overflow. 168 // Update all button's visibility in overflow.
174 void UpdateAllButtonsVisibilityInOverflowMode(); 169 void UpdateAllButtonsVisibilityInOverflowMode();
175 170
176 // Calculates the ideal bounds. The bounds of each button corresponding to an 171 // Calculates the ideal bounds. The bounds of each button corresponding to an
177 // item in the model is set in |view_model_|. 172 // item in the model is set in |view_model_|.
178 void CalculateIdealBounds(IdealBounds* bounds) const; 173 void CalculateIdealBounds(IdealBounds* bounds) const;
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
322 // Get the distance from the given |coordinate| to the closest point on this 317 // Get the distance from the given |coordinate| to the closest point on this
323 // launcher/shelf. 318 // launcher/shelf.
324 int CalculateShelfDistance(const gfx::Point& coordinate) const; 319 int CalculateShelfDistance(const gfx::Point& coordinate) const;
325 320
326 // The model; owned by Launcher. 321 // The model; owned by Launcher.
327 ShelfModel* model_; 322 ShelfModel* model_;
328 323
329 // Delegate; owned by Launcher. 324 // Delegate; owned by Launcher.
330 ShelfDelegate* delegate_; 325 ShelfDelegate* delegate_;
331 326
327 // The shelf; owned by ShelfWidget.
328 Shelf* shelf_;
329
332 // Used to manage the set of active launcher buttons. There is a view per 330 // Used to manage the set of active launcher buttons. There is a view per
333 // item in |model_|. 331 // item in |model_|.
334 scoped_ptr<views::ViewModel> view_model_; 332 scoped_ptr<views::ViewModel> view_model_;
335 333
336 // Index of first visible launcher item. 334 // Index of first visible launcher item.
337 int first_visible_index_; 335 int first_visible_index_;
338 336
339 // Last index of a launcher button that is visible 337 // Last index of a launcher button that is visible
340 // (does not go into overflow). 338 // (does not go into overflow).
341 mutable int last_visible_index_; 339 mutable int last_visible_index_;
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
421 419
422 // True when the icon was dragged off the shelf. 420 // True when the icon was dragged off the shelf.
423 bool dragged_off_shelf_; 421 bool dragged_off_shelf_;
424 422
425 // The rip off view when a snap back operation is underway. 423 // The rip off view when a snap back operation is underway.
426 views::View* snap_back_from_rip_off_view_; 424 views::View* snap_back_from_rip_off_view_;
427 425
428 // Holds ShelfItemDelegateManager. 426 // Holds ShelfItemDelegateManager.
429 ShelfItemDelegateManager* item_manager_; 427 ShelfItemDelegateManager* item_manager_;
430 428
431 // Holds ShelfLayoutManager.
432 ShelfLayoutManager* layout_manager_;
433
434 // True when this ShelfView is used for Overflow Bubble. 429 // True when this ShelfView is used for Overflow Bubble.
435 bool overflow_mode_; 430 bool overflow_mode_;
436 431
437 // Holds a pointer to main ShelfView when a ShelfView is in overflow mode. 432 // Holds a pointer to main ShelfView when a ShelfView is in overflow mode.
438 ShelfView* main_shelf_; 433 ShelfView* main_shelf_;
439 434
440 // True when ripped item from overflow bubble is entered into Shelf. 435 // True when ripped item from overflow bubble is entered into Shelf.
441 bool dragged_off_from_overflow_to_shelf_; 436 bool dragged_off_from_overflow_to_shelf_;
442 437
443 // True if the event is a repost event from a event which has just closed the 438 // True if the event is a repost event from a event which has just closed the
444 // menu of the same shelf item. 439 // menu of the same shelf item.
445 bool is_repost_event_; 440 bool is_repost_event_;
446 441
447 // Record the index for the last pressed shelf item. This variable is used to 442 // Record the index for the last pressed shelf item. This variable is used to
448 // check if a repost event occurs on the same shelf item as previous one. If 443 // check if a repost event occurs on the same shelf item as previous one. If
449 // so, the repost event should be ignored. 444 // so, the repost event should be ignored.
450 int last_pressed_index_; 445 int last_pressed_index_;
451 446
452 // Tracks UMA metrics based on shelf button press actions. 447 // Tracks UMA metrics based on shelf button press actions.
453 ShelfButtonPressedMetricTracker shelf_button_pressed_metric_tracker_; 448 ShelfButtonPressedMetricTracker shelf_button_pressed_metric_tracker_;
454 449
455 DISALLOW_COPY_AND_ASSIGN(ShelfView); 450 DISALLOW_COPY_AND_ASSIGN(ShelfView);
456 }; 451 };
457 452
458 } // namespace ash 453 } // namespace ash
459 454
460 #endif // ASH_SHELF_SHELF_VIEW_H_ 455 #endif // ASH_SHELF_SHELF_VIEW_H_
OLDNEW
« no previous file with comments | « ash/shelf/shelf_tooltip_manager.cc ('k') | ash/shelf/shelf_view.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698