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

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: 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.
tdanderson 2016/06/29 17:46:19 Please add to this comment to explain what |insets
yiyix 2016/06/29 18:56:39 Done.
69 virtual void Initialize(); 73 virtual void Initialize(const gfx::Insets& insets);
70 74
71 // Initializes animations for the bubble. 75 // Initializes animations for the bubble.
72 static void InitializeBubbleAnimations(views::Widget* bubble_widget); 76 static void InitializeBubbleAnimations(views::Widget* bubble_widget);
73 77
74 // views::View: 78 // views::View:
75 void SetVisible(bool visible) override; 79 void SetVisible(bool visible) override;
76 const char* GetClassName() const override; 80 const char* GetClassName() const override;
77 void ChildPreferredSizeChanged(views::View* child) override; 81 void ChildPreferredSizeChanged(views::View* child) override;
78 void GetAccessibleState(ui::AXViewState* state) override; 82 void GetAccessibleState(ui::AXViewState* state) override;
79 void AboutToRequestFocusFromTabTraversal(bool reverse) override; 83 void AboutToRequestFocusFromTabTraversal(bool reverse) override;
80 84
81 // ActionableView: 85 // ActionableView:
82 bool PerformAction(const ui::Event& event) override; 86 bool PerformAction(const ui::Event& event) override;
83 gfx::Rect GetFocusBounds() override; 87 gfx::Rect GetFocusBounds() override;
84 void OnGestureEvent(ui::GestureEvent* event) override; 88 void OnGestureEvent(ui::GestureEvent* event) override;
85 89
86 // BackgroundAnimatorDelegate: 90 // BackgroundAnimatorDelegate:
87 void UpdateBackground(int alpha) override; 91 void UpdateBackground(int alpha) override;
88 92
89 // Called whenever the shelf alignment changes. 93 // Called whenever the shelf alignment changes.
tdanderson 2016/06/29 17:46:19 Please add to this comment to explain |insets|
yiyix 2016/06/29 18:56:39 Done.
90 virtual void SetShelfAlignment(ShelfAlignment alignment); 94 virtual void SetShelfAlignment(ShelfAlignment alignment,
95 const gfx::Insets& insets);
91 96
92 // Called when the anchor (tray or bubble) may have moved or changed. 97 // Called when the anchor (tray or bubble) may have moved or changed.
93 virtual void AnchorUpdated() {} 98 virtual void AnchorUpdated() {}
94 99
95 // Called from GetAccessibleState, must return a valid accessible name. 100 // Called from GetAccessibleState, must return a valid accessible name.
96 virtual base::string16 GetAccessibleNameForTray() = 0; 101 virtual base::string16 GetAccessibleNameForTray() = 0;
97 102
98 // Called when the bubble is resized. 103 // Called when the bubble is resized.
99 virtual void BubbleResized(const views::TrayBubbleView* bubble_view) {} 104 virtual void BubbleResized(const views::TrayBubbleView* bubble_view) {}
100 105
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 TrayEventFilter* tray_event_filter() { return tray_event_filter_.get(); } 137 TrayEventFilter* tray_event_filter() { return tray_event_filter_.get(); }
133 WmShelf* shelf() { return wm_shelf_; } 138 WmShelf* shelf() { return wm_shelf_; }
134 139
135 // Updates the arrow visibility based on the launcher visibility. 140 // Updates the arrow visibility based on the launcher visibility.
136 void UpdateBubbleViewArrow(views::TrayBubbleView* bubble_view); 141 void UpdateBubbleViewArrow(views::TrayBubbleView* bubble_view);
137 142
138 private: 143 private:
139 class TrayWidgetObserver; 144 class TrayWidgetObserver;
140 145
141 // Called from Initialize after all status area trays have been created. 146 // Called from Initialize after all status area trays have been created.
142 // Sets the border based on the position of the view. 147 // Sets the border based on given |insets|.
143 void SetTrayBorder(); 148 void SetTrayBorder(const gfx::Insets& insets);
144 149
145 // ui::ImplicitAnimationObserver: 150 // ui::ImplicitAnimationObserver:
146 void OnImplicitAnimationsCompleted() override; 151 void OnImplicitAnimationsCompleted() override;
147 bool RequiresNotificationWhenAnimatorDestroyed() const override; 152 bool RequiresNotificationWhenAnimatorDestroyed() const override;
148 153
149 // Applies transformations to the |layer()| to animate the view when 154 // Applies transformations to the |layer()| to animate the view when
150 // SetVisible(false) is called. 155 // SetVisible(false) is called.
151 void HideTransformation(); 156 void HideTransformation();
152 157
153 // The shelf containing the system tray for this view. 158 // The shelf containing the system tray for this view.
(...skipping 15 matching lines...) Expand all
169 174
170 std::unique_ptr<TrayWidgetObserver> widget_observer_; 175 std::unique_ptr<TrayWidgetObserver> widget_observer_;
171 std::unique_ptr<TrayEventFilter> tray_event_filter_; 176 std::unique_ptr<TrayEventFilter> tray_event_filter_;
172 177
173 DISALLOW_COPY_AND_ASSIGN(TrayBackgroundView); 178 DISALLOW_COPY_AND_ASSIGN(TrayBackgroundView);
174 }; 179 };
175 180
176 } // namespace ash 181 } // namespace ash
177 182
178 #endif // ASH_COMMON_SYSTEM_TRAY_TRAY_BACKGROUND_VIEW_H_ 183 #endif // ASH_COMMON_SYSTEM_TRAY_TRAY_BACKGROUND_VIEW_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698