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

Side by Side Diff: ash/common/system/tray/tray_background_view.h

Issue 2103113003: Fix shelf layout when switching from left-aligned shelf to right-aligned shelf (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Merge Created 4 years, 5 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_COMMON_SYSTEM_TRAY_TRAY_BACKGROUND_VIEW_H_ 5 #ifndef ASH_COMMON_SYSTEM_TRAY_TRAY_BACKGROUND_VIEW_H_
6 #define ASH_COMMON_SYSTEM_TRAY_TRAY_BACKGROUND_VIEW_H_ 6 #define ASH_COMMON_SYSTEM_TRAY_TRAY_BACKGROUND_VIEW_H_
7 7
8 #include <memory> 8 #include <memory>
9 9
10 #include "ash/ash_export.h" 10 #include "ash/ash_export.h"
11 #include "ash/common/shelf/shelf_types.h" 11 #include "ash/common/shelf/shelf_types.h"
12 #include "ash/common/system/tray/actionable_view.h" 12 #include "ash/common/system/tray/actionable_view.h"
13 #include "ash/common/wm/background_animator.h" 13 #include "ash/common/wm/background_animator.h"
14 #include "base/macros.h" 14 #include "base/macros.h"
15 #include "ui/compositor/layer_animation_observer.h" 15 #include "ui/compositor/layer_animation_observer.h"
16 #include "ui/views/bubble/tray_bubble_view.h" 16 #include "ui/views/bubble/tray_bubble_view.h"
17 17
18 namespace gfx {
19 class Insets;
20 }
21
18 namespace ash { 22 namespace ash {
19 class ShelfLayoutManager; 23 class ShelfLayoutManager;
20 class TrayEventFilter; 24 class TrayEventFilter;
21 class TrayBackground; 25 class TrayBackground;
22 class WmShelf; 26 class WmShelf;
23 27
24 // Base class for children of StatusAreaWidget: SystemTray, WebNotificationTray, 28 // Base class for children of StatusAreaWidget: SystemTray, WebNotificationTray,
25 // LogoutButtonTray, OverviewButtonTray. 29 // LogoutButtonTray, OverviewButtonTray.
26 // This class handles setting and animating the background when the Launcher 30 // This class handles setting and animating the background when the Launcher
27 // his shown/hidden. It also inherits from ActionableView so that the tray 31 // his shown/hidden. It also inherits from ActionableView so that the tray
(...skipping 30 matching lines...) Expand all
58 62
59 ShelfAlignment alignment_; 63 ShelfAlignment alignment_;
60 gfx::Size size_; 64 gfx::Size size_;
61 65
62 DISALLOW_COPY_AND_ASSIGN(TrayContainer); 66 DISALLOW_COPY_AND_ASSIGN(TrayContainer);
63 }; 67 };
64 68
65 explicit TrayBackgroundView(WmShelf* wm_shelf); 69 explicit TrayBackgroundView(WmShelf* wm_shelf);
66 ~TrayBackgroundView() override; 70 ~TrayBackgroundView() override;
67 71
68 // Called after the tray has been added to the widget containing it. 72 // Called after the tray has been added to the widget containing it. Set the
69 virtual void Initialize(); 73 // tray items with border specified in |insets|.
74 virtual void Initialize(const gfx::Insets& insets);
70 75
71 // Initializes animations for the bubble. 76 // Initializes animations for the bubble.
72 static void InitializeBubbleAnimations(views::Widget* bubble_widget); 77 static void InitializeBubbleAnimations(views::Widget* bubble_widget);
73 78
74 // views::View: 79 // views::View:
75 void SetVisible(bool visible) override; 80 void SetVisible(bool visible) override;
76 const char* GetClassName() const override; 81 const char* GetClassName() const override;
77 void ChildPreferredSizeChanged(views::View* child) override; 82 void ChildPreferredSizeChanged(views::View* child) override;
78 void GetAccessibleState(ui::AXViewState* state) override; 83 void GetAccessibleState(ui::AXViewState* state) override;
79 void AboutToRequestFocusFromTabTraversal(bool reverse) override; 84 void AboutToRequestFocusFromTabTraversal(bool reverse) override;
80 85
81 // ActionableView: 86 // ActionableView:
82 bool PerformAction(const ui::Event& event) override; 87 bool PerformAction(const ui::Event& event) override;
83 gfx::Rect GetFocusBounds() override; 88 gfx::Rect GetFocusBounds() override;
84 void OnGestureEvent(ui::GestureEvent* event) override; 89 void OnGestureEvent(ui::GestureEvent* event) override;
85 90
86 // BackgroundAnimatorDelegate: 91 // BackgroundAnimatorDelegate:
87 void UpdateBackground(int alpha) override; 92 void UpdateBackground(int alpha) override;
88 93
89 // Called whenever the shelf alignment changes. 94 // Called whenever the shelf alignment changes and set the tray items with the
90 virtual void SetShelfAlignment(ShelfAlignment alignment); 95 // new border based on alignment specified in |insets|.
96 virtual void SetShelfAlignment(ShelfAlignment alignment,
97 const gfx::Insets& insets);
91 98
92 // Called when the anchor (tray or bubble) may have moved or changed. 99 // Called when the anchor (tray or bubble) may have moved or changed.
93 virtual void AnchorUpdated() {} 100 virtual void AnchorUpdated() {}
94 101
95 // Called from GetAccessibleState, must return a valid accessible name. 102 // Called from GetAccessibleState, must return a valid accessible name.
96 virtual base::string16 GetAccessibleNameForTray() = 0; 103 virtual base::string16 GetAccessibleNameForTray() = 0;
97 104
98 // Called when the bubble is resized. 105 // Called when the bubble is resized.
99 virtual void BubbleResized(const views::TrayBubbleView* bubble_view) {} 106 virtual void BubbleResized(const views::TrayBubbleView* bubble_view) {}
100 107
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 TrayEventFilter* tray_event_filter() { return tray_event_filter_.get(); } 139 TrayEventFilter* tray_event_filter() { return tray_event_filter_.get(); }
133 WmShelf* shelf() { return wm_shelf_; } 140 WmShelf* shelf() { return wm_shelf_; }
134 141
135 // Updates the arrow visibility based on the launcher visibility. 142 // Updates the arrow visibility based on the launcher visibility.
136 void UpdateBubbleViewArrow(views::TrayBubbleView* bubble_view); 143 void UpdateBubbleViewArrow(views::TrayBubbleView* bubble_view);
137 144
138 private: 145 private:
139 class TrayWidgetObserver; 146 class TrayWidgetObserver;
140 147
141 // Called from Initialize after all status area trays have been created. 148 // Called from Initialize after all status area trays have been created.
142 // Sets the border based on the position of the view. 149 // Sets the border based on given |insets|.
143 void SetTrayBorder(); 150 void SetTrayBorder(const gfx::Insets& insets);
144 151
145 // ui::ImplicitAnimationObserver: 152 // ui::ImplicitAnimationObserver:
146 void OnImplicitAnimationsCompleted() override; 153 void OnImplicitAnimationsCompleted() override;
147 bool RequiresNotificationWhenAnimatorDestroyed() const override; 154 bool RequiresNotificationWhenAnimatorDestroyed() const override;
148 155
149 // Applies transformations to the |layer()| to animate the view when 156 // Applies transformations to the |layer()| to animate the view when
150 // SetVisible(false) is called. 157 // SetVisible(false) is called.
151 void HideTransformation(); 158 void HideTransformation();
152 159
153 // The shelf containing the system tray for this view. 160 // The shelf containing the system tray for this view.
(...skipping 15 matching lines...) Expand all
169 176
170 std::unique_ptr<TrayWidgetObserver> widget_observer_; 177 std::unique_ptr<TrayWidgetObserver> widget_observer_;
171 std::unique_ptr<TrayEventFilter> tray_event_filter_; 178 std::unique_ptr<TrayEventFilter> tray_event_filter_;
172 179
173 DISALLOW_COPY_AND_ASSIGN(TrayBackgroundView); 180 DISALLOW_COPY_AND_ASSIGN(TrayBackgroundView);
174 }; 181 };
175 182
176 } // namespace ash 183 } // namespace ash
177 184
178 #endif // ASH_COMMON_SYSTEM_TRAY_TRAY_BACKGROUND_VIEW_H_ 185 #endif // ASH_COMMON_SYSTEM_TRAY_TRAY_BACKGROUND_VIEW_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698