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

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

Issue 2053113002: Replaced BackgroundAnimator with ShelfBackgroundAnimator. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Made the ShelfView add/remove itself as an observer from the ShelfBackgroundAnimator. Created 4 years, 4 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
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 <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_background_animator_observer.h"
14 #include "ash/common/shelf/shelf_item_delegate.h" 15 #include "ash/common/shelf/shelf_item_delegate.h"
15 #include "ash/common/shelf/shelf_model_observer.h" 16 #include "ash/common/shelf/shelf_model_observer.h"
16 #include "ash/shelf/shelf_button_pressed_metric_tracker.h" 17 #include "ash/shelf/shelf_button_pressed_metric_tracker.h"
17 #include "ash/shelf/shelf_tooltip_manager.h" 18 #include "ash/shelf/shelf_tooltip_manager.h"
18 #include "ash/wm/gestures/shelf_gesture_handler.h" 19 #include "ash/wm/gestures/shelf_gesture_handler.h"
19 #include "base/macros.h" 20 #include "base/macros.h"
20 #include "base/observer_list.h" 21 #include "base/observer_list.h"
21 #include "ui/app_list/views/app_list_drag_and_drop_host.h" 22 #include "ui/app_list/views/app_list_drag_and_drop_host.h"
22 #include "ui/views/animation/bounds_animator_observer.h" 23 #include "ui/views/animation/bounds_animator_observer.h"
23 #include "ui/views/animation/ink_drop_state.h" 24 #include "ui/views/animation/ink_drop_state.h"
(...skipping 13 matching lines...) Expand all
37 class MenuRunner; 38 class MenuRunner;
38 } 39 }
39 40
40 namespace ash { 41 namespace ash {
41 class AppListButton; 42 class AppListButton;
42 class DragImageView; 43 class DragImageView;
43 class OverflowBubble; 44 class OverflowBubble;
44 class OverflowButton; 45 class OverflowButton;
45 class ScopedTargetRootWindow; 46 class ScopedTargetRootWindow;
46 class Shelf; 47 class Shelf;
48 class ShelfBackgroundAnimator;
47 class ShelfButton; 49 class ShelfButton;
48 class ShelfDelegate; 50 class ShelfDelegate;
49 class ShelfIconObserver; 51 class ShelfIconObserver;
50 class ShelfModel; 52 class ShelfModel;
51 struct ShelfItem; 53 struct ShelfItem;
52 class WmShelf; 54 class WmShelf;
53 55
54 namespace test { 56 namespace test {
55 class ShelfViewTestAPI; 57 class ShelfViewTestAPI;
56 } 58 }
57 59
58 extern const int SHELF_ALIGNMENT_UMA_ENUM_VALUE_BOTTOM; 60 extern const int SHELF_ALIGNMENT_UMA_ENUM_VALUE_BOTTOM;
59 extern const int SHELF_ALIGNMENT_UMA_ENUM_VALUE_LEFT; 61 extern const int SHELF_ALIGNMENT_UMA_ENUM_VALUE_LEFT;
60 extern const int SHELF_ALIGNMENT_UMA_ENUM_VALUE_RIGHT; 62 extern const int SHELF_ALIGNMENT_UMA_ENUM_VALUE_RIGHT;
61 extern const int SHELF_ALIGNMENT_UMA_ENUM_VALUE_COUNT; 63 extern const int SHELF_ALIGNMENT_UMA_ENUM_VALUE_COUNT;
62 64
63 class ASH_EXPORT ShelfView : public views::View, 65 class ASH_EXPORT ShelfView : public views::View,
66 public ShelfBackgroundAnimatorObserver,
64 public ShelfModelObserver, 67 public ShelfModelObserver,
65 public InkDropButtonListener, 68 public InkDropButtonListener,
66 public views::ContextMenuController, 69 public views::ContextMenuController,
67 public views::FocusTraversable, 70 public views::FocusTraversable,
68 public views::BoundsAnimatorObserver, 71 public views::BoundsAnimatorObserver,
69 public app_list::ApplicationDragAndDropHost { 72 public app_list::ApplicationDragAndDropHost {
70 public: 73 public:
71 ShelfView(ShelfModel* model, 74 ShelfView(ShelfModel* model,
72 ShelfDelegate* delegate, 75 ShelfDelegate* delegate,
73 WmShelf* wm_shelf, 76 WmShelf* wm_shelf,
74 Shelf* shelf); 77 Shelf* shelf,
78 ShelfBackgroundAnimator* background_animator);
75 ~ShelfView() override; 79 ~ShelfView() override;
76 80
77 Shelf* shelf() const { return shelf_; } 81 Shelf* shelf() const { return shelf_; }
78 ShelfModel* model() const { return model_; } 82 ShelfModel* model() const { return model_; }
79 83
80 void Init(); 84 void Init();
81 85
82 void OnShelfAlignmentChanged(); 86 void OnShelfAlignmentChanged();
83 void SchedulePaintForAllButtons(); 87 void SchedulePaintForAllButtons();
84 88
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 gfx::Size GetPreferredSize() const override; 279 gfx::Size GetPreferredSize() const override;
276 void OnBoundsChanged(const gfx::Rect& previous_bounds) override; 280 void OnBoundsChanged(const gfx::Rect& previous_bounds) override;
277 FocusTraversable* GetPaneFocusTraversable() override; 281 FocusTraversable* GetPaneFocusTraversable() override;
278 void GetAccessibleState(ui::AXViewState* state) override; 282 void GetAccessibleState(ui::AXViewState* state) override;
279 void ViewHierarchyChanged( 283 void ViewHierarchyChanged(
280 const ViewHierarchyChangedDetails& details) override; 284 const ViewHierarchyChangedDetails& details) override;
281 285
282 // Overridden from ui::EventHandler: 286 // Overridden from ui::EventHandler:
283 void OnGestureEvent(ui::GestureEvent* event) override; 287 void OnGestureEvent(ui::GestureEvent* event) override;
284 288
289 // ShelfBackgroundAnimatorObserver:
290 void UpdateShelfItemBackground(int alpha) override;
291
285 // Overridden from ShelfModelObserver: 292 // Overridden from ShelfModelObserver:
286 void ShelfItemAdded(int model_index) override; 293 void ShelfItemAdded(int model_index) override;
287 void ShelfItemRemoved(int model_index, ShelfID id) override; 294 void ShelfItemRemoved(int model_index, ShelfID id) override;
288 void ShelfItemChanged(int model_index, const ShelfItem& old_item) override; 295 void ShelfItemChanged(int model_index, const ShelfItem& old_item) override;
289 void ShelfItemMoved(int start_index, int target_index) override; 296 void ShelfItemMoved(int start_index, int target_index) override;
290 void OnSetShelfItemDelegate(ShelfID id, 297 void OnSetShelfItemDelegate(ShelfID id,
291 ShelfItemDelegate* item_delegate) override; 298 ShelfItemDelegate* item_delegate) override;
292 299
293 // Overridden from InkDropButtonListener: 300 // Overridden from InkDropButtonListener:
294 void ButtonPressed(views::Button* sender, 301 void ButtonPressed(views::Button* sender,
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
460 bool is_repost_event_on_same_item_; 467 bool is_repost_event_on_same_item_;
461 468
462 // Record the index for the last pressed shelf item. This variable is used to 469 // Record the index for the last pressed shelf item. This variable is used to
463 // check if a repost event occurs on the same shelf item as previous one. If 470 // check if a repost event occurs on the same shelf item as previous one. If
464 // so, the repost event should be ignored. 471 // so, the repost event should be ignored.
465 int last_pressed_index_; 472 int last_pressed_index_;
466 473
467 // Tracks UMA metrics based on shelf button press actions. 474 // Tracks UMA metrics based on shelf button press actions.
468 ShelfButtonPressedMetricTracker shelf_button_pressed_metric_tracker_; 475 ShelfButtonPressedMetricTracker shelf_button_pressed_metric_tracker_;
469 476
477 // The background animator to observe. Can be null.
478 ShelfBackgroundAnimator* background_animator_;
479
470 DISALLOW_COPY_AND_ASSIGN(ShelfView); 480 DISALLOW_COPY_AND_ASSIGN(ShelfView);
471 }; 481 };
472 482
473 } // namespace ash 483 } // namespace ash
474 484
475 #endif // ASH_SHELF_SHELF_VIEW_H_ 485 #endif // ASH_SHELF_SHELF_VIEW_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698