Chromium Code Reviews| 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_COMMON_SHELF_SHELF_VIEW_H_ | 5 #ifndef ASH_COMMON_SHELF_SHELF_VIEW_H_ |
| 6 #define ASH_COMMON_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" |
| 17 #include "ash/common/shelf/shelf_tooltip_manager.h" | 17 #include "ash/common/shelf/shelf_tooltip_manager.h" |
| 18 #include "base/macros.h" | 18 #include "base/macros.h" |
| 19 #include "base/observer_list.h" | |
| 20 #include "ui/app_list/views/app_list_drag_and_drop_host.h" | 19 #include "ui/app_list/views/app_list_drag_and_drop_host.h" |
| 21 #include "ui/views/animation/bounds_animator_observer.h" | 20 #include "ui/views/animation/bounds_animator_observer.h" |
| 22 #include "ui/views/animation/ink_drop_state.h" | 21 #include "ui/views/animation/ink_drop_state.h" |
| 23 #include "ui/views/context_menu_controller.h" | 22 #include "ui/views/context_menu_controller.h" |
| 24 #include "ui/views/controls/button/button.h" | 23 #include "ui/views/controls/button/button.h" |
| 25 #include "ui/views/focus/focus_manager.h" | 24 #include "ui/views/focus/focus_manager.h" |
| 26 #include "ui/views/view.h" | 25 #include "ui/views/view.h" |
| 27 #include "ui/views/view_model.h" | 26 #include "ui/views/view_model.h" |
| 28 | 27 |
| 29 namespace ui { | 28 namespace ui { |
| 30 class MenuModel; | 29 class MenuModel; |
| 31 } | 30 } |
| 32 | 31 |
| 33 namespace views { | 32 namespace views { |
| 34 class BoundsAnimator; | 33 class BoundsAnimator; |
| 35 class MenuModelAdapter; | 34 class MenuModelAdapter; |
| 36 class MenuRunner; | 35 class MenuRunner; |
| 37 } | 36 } |
| 38 | 37 |
| 39 namespace ash { | 38 namespace ash { |
| 40 class AppListButton; | 39 class AppListButton; |
| 41 class DragImageView; | 40 class DragImageView; |
| 42 class OverflowBubble; | 41 class OverflowBubble; |
| 43 class OverflowButton; | 42 class OverflowButton; |
| 44 class ScopedRootWindowForNewWindows; | 43 class ScopedRootWindowForNewWindows; |
| 45 class ShelfButton; | 44 class ShelfButton; |
| 46 class ShelfDelegate; | 45 class ShelfDelegate; |
| 47 class ShelfIconObserver; | |
| 48 class ShelfModel; | 46 class ShelfModel; |
| 49 struct ShelfItem; | 47 struct ShelfItem; |
| 50 class ShelfWidget; | 48 class ShelfWidget; |
| 51 class WmShelf; | 49 class WmShelf; |
| 52 | 50 |
| 53 namespace test { | 51 namespace test { |
| 54 class ShelfViewTestAPI; | 52 class ShelfViewTestAPI; |
| 55 } | 53 } |
| 56 | 54 |
| 57 extern const int SHELF_ALIGNMENT_UMA_ENUM_VALUE_BOTTOM; | 55 extern const int SHELF_ALIGNMENT_UMA_ENUM_VALUE_BOTTOM; |
| (...skipping 24 matching lines...) Expand all Loading... | |
| 82 void SchedulePaintForAllButtons(); | 80 void SchedulePaintForAllButtons(); |
| 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(ShelfID id); | 85 gfx::Rect GetIdealBoundsOfItemIcon(ShelfID id); |
| 88 | 86 |
| 89 // Repositions the icon for the specified item by the midpoint of the window. | 87 // Repositions the icon for the specified item by the midpoint of the window. |
| 90 void UpdatePanelIconPosition(ShelfID id, const gfx::Point& midpoint); | 88 void UpdatePanelIconPosition(ShelfID id, const gfx::Point& midpoint); |
| 91 | 89 |
| 92 void AddIconObserver(ShelfIconObserver* observer); | |
| 93 void RemoveIconObserver(ShelfIconObserver* observer); | |
| 94 | |
| 95 // Returns true if we're showing a menu. | 90 // Returns true if we're showing a menu. |
| 96 bool IsShowingMenu() const; | 91 bool IsShowingMenu() const; |
| 97 | 92 |
| 98 // Returns true if overflow bubble is shown. | 93 // Returns true if overflow bubble is shown. |
| 99 bool IsShowingOverflowBubble() const; | 94 bool IsShowingOverflowBubble() const; |
| 100 | 95 |
| 101 // Sets owner overflow bubble instance from which this shelf view pops | 96 // Sets owner overflow bubble instance from which this shelf view pops |
| 102 // out as overflow. | 97 // out as overflow. |
| 103 void set_owner_overflow_bubble(OverflowBubble* owner) { | 98 void set_owner_overflow_bubble(OverflowBubble* owner) { |
| 104 owner_overflow_bubble_ = owner; | 99 owner_overflow_bubble_ = owner; |
| (...skipping 290 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 395 | 390 |
| 396 std::unique_ptr<views::FocusSearch> focus_search_; | 391 std::unique_ptr<views::FocusSearch> focus_search_; |
| 397 | 392 |
| 398 // Manages the context menu, and the list menu. | 393 // Manages the context menu, and the list menu. |
| 399 std::unique_ptr<ui::MenuModel> menu_model_; | 394 std::unique_ptr<ui::MenuModel> menu_model_; |
| 400 std::unique_ptr<views::MenuModelAdapter> menu_model_adapter_; | 395 std::unique_ptr<views::MenuModelAdapter> menu_model_adapter_; |
| 401 std::unique_ptr<views::MenuRunner> launcher_menu_runner_; | 396 std::unique_ptr<views::MenuRunner> launcher_menu_runner_; |
| 402 std::unique_ptr<ScopedRootWindowForNewWindows> | 397 std::unique_ptr<ScopedRootWindowForNewWindows> |
| 403 scoped_root_window_for_new_windows_; | 398 scoped_root_window_for_new_windows_; |
| 404 | 399 |
| 405 base::ObserverList<ShelfIconObserver> observers_; | |
|
James Cook
2016/08/16 23:21:35
Yeah, I like getting rid of this. Good call.
msw
2016/08/17 01:09:01
Acknowledged.
| |
| 406 | |
| 407 // Amount content is inset on the left edge (or top edge for vertical | 400 // Amount content is inset on the left edge (or top edge for vertical |
| 408 // alignment). | 401 // alignment). |
| 409 int leading_inset_; | 402 int leading_inset_; |
| 410 | 403 |
| 411 // True when an item being inserted or removed in the model cancels a drag. | 404 // True when an item being inserted or removed in the model cancels a drag. |
| 412 bool cancelling_drag_model_changed_; | 405 bool cancelling_drag_model_changed_; |
| 413 | 406 |
| 414 // Index of the last hidden launcher item. If there are no hidden items this | 407 // Index of the last hidden launcher item. If there are no hidden items this |
| 415 // will be equal to last_visible_index_ + 1. | 408 // will be equal to last_visible_index_ + 1. |
| 416 mutable int last_hidden_index_; | 409 mutable int last_hidden_index_; |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 468 | 461 |
| 469 // Tracks UMA metrics based on shelf button press actions. | 462 // Tracks UMA metrics based on shelf button press actions. |
| 470 ShelfButtonPressedMetricTracker shelf_button_pressed_metric_tracker_; | 463 ShelfButtonPressedMetricTracker shelf_button_pressed_metric_tracker_; |
| 471 | 464 |
| 472 DISALLOW_COPY_AND_ASSIGN(ShelfView); | 465 DISALLOW_COPY_AND_ASSIGN(ShelfView); |
| 473 }; | 466 }; |
| 474 | 467 |
| 475 } // namespace ash | 468 } // namespace ash |
| 476 | 469 |
| 477 #endif // ASH_COMMON_SHELF_SHELF_VIEW_H_ | 470 #endif // ASH_COMMON_SHELF_SHELF_VIEW_H_ |
| OLD | NEW |