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

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

Issue 1914093002: Refactors DockedWindowLayoutManager in terms of ash/wm/common (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@nuke_aura_window
Patch Set: merge 2 trunk Created 4 years, 8 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_SYSTEM_TRAY_TRAY_BACKGROUND_VIEW_H_ 5 #ifndef ASH_SYSTEM_TRAY_TRAY_BACKGROUND_VIEW_H_
6 #define ASH_SYSTEM_TRAY_TRAY_BACKGROUND_VIEW_H_ 6 #define ASH_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"
(...skipping 18 matching lines...) Expand all
29 class ASH_EXPORT TrayBackgroundView : public ActionableView, 29 class ASH_EXPORT TrayBackgroundView : public ActionableView,
30 public BackgroundAnimatorDelegate, 30 public BackgroundAnimatorDelegate,
31 public ui::ImplicitAnimationObserver { 31 public ui::ImplicitAnimationObserver {
32 public: 32 public:
33 static const char kViewClassName[]; 33 static const char kViewClassName[];
34 34
35 // Base class for tray containers. Sets the border and layout. The container 35 // Base class for tray containers. Sets the border and layout. The container
36 // auto-resizes the widget when necessary. 36 // auto-resizes the widget when necessary.
37 class TrayContainer : public views::View { 37 class TrayContainer : public views::View {
38 public: 38 public:
39 explicit TrayContainer(ShelfAlignment alignment); 39 explicit TrayContainer(wm::ShelfAlignment alignment);
40 ~TrayContainer() override {} 40 ~TrayContainer() override {}
41 41
42 void SetAlignment(ShelfAlignment alignment); 42 void SetAlignment(wm::ShelfAlignment alignment);
43 43
44 void set_size(const gfx::Size& size) { size_ = size; } 44 void set_size(const gfx::Size& size) { size_ = size; }
45 45
46 // views::View: 46 // views::View:
47 gfx::Size GetPreferredSize() const override; 47 gfx::Size GetPreferredSize() const override;
48 48
49 protected: 49 protected:
50 // views::View: 50 // views::View:
51 void ChildPreferredSizeChanged(views::View* child) override; 51 void ChildPreferredSizeChanged(views::View* child) override;
52 void ChildVisibilityChanged(View* child) override; 52 void ChildVisibilityChanged(View* child) override;
53 void ViewHierarchyChanged( 53 void ViewHierarchyChanged(
54 const ViewHierarchyChangedDetails& details) override; 54 const ViewHierarchyChangedDetails& details) override;
55 55
56 private: 56 private:
57 void UpdateLayout(); 57 void UpdateLayout();
58 58
59 ShelfAlignment alignment_; 59 wm::ShelfAlignment alignment_;
60 gfx::Size size_; 60 gfx::Size size_;
61 61
62 DISALLOW_COPY_AND_ASSIGN(TrayContainer); 62 DISALLOW_COPY_AND_ASSIGN(TrayContainer);
63 }; 63 };
64 64
65 explicit TrayBackgroundView(StatusAreaWidget* status_area_widget); 65 explicit TrayBackgroundView(StatusAreaWidget* status_area_widget);
66 ~TrayBackgroundView() override; 66 ~TrayBackgroundView() override;
67 67
68 // Called after the tray has been added to the widget containing it. 68 // Called after the tray has been added to the widget containing it.
69 virtual void Initialize(); 69 virtual void Initialize();
70 70
71 // views::View: 71 // views::View:
72 void SetVisible(bool visible) override; 72 void SetVisible(bool visible) override;
73 const char* GetClassName() const override; 73 const char* GetClassName() const override;
74 void OnMouseEntered(const ui::MouseEvent& event) override; 74 void OnMouseEntered(const ui::MouseEvent& event) override;
75 void OnMouseExited(const ui::MouseEvent& event) override; 75 void OnMouseExited(const ui::MouseEvent& event) override;
76 void ChildPreferredSizeChanged(views::View* child) override; 76 void ChildPreferredSizeChanged(views::View* child) override;
77 void GetAccessibleState(ui::AXViewState* state) override; 77 void GetAccessibleState(ui::AXViewState* state) override;
78 void AboutToRequestFocusFromTabTraversal(bool reverse) override; 78 void AboutToRequestFocusFromTabTraversal(bool reverse) override;
79 79
80 // ActionableView: 80 // ActionableView:
81 bool PerformAction(const ui::Event& event) override; 81 bool PerformAction(const ui::Event& event) override;
82 gfx::Rect GetFocusBounds() override; 82 gfx::Rect GetFocusBounds() override;
83 void OnGestureEvent(ui::GestureEvent* event) override; 83 void OnGestureEvent(ui::GestureEvent* event) override;
84 84
85 // BackgroundAnimatorDelegate: 85 // BackgroundAnimatorDelegate:
86 void UpdateBackground(int alpha) override; 86 void UpdateBackground(int alpha) override;
87 87
88 // Called whenever the shelf alignment changes. 88 // Called whenever the shelf alignment changes.
89 virtual void SetShelfAlignment(ShelfAlignment alignment); 89 virtual void SetShelfAlignment(wm::ShelfAlignment alignment);
90 90
91 // Called when the anchor (tray or bubble) may have moved or changed. 91 // Called when the anchor (tray or bubble) may have moved or changed.
92 virtual void AnchorUpdated() {} 92 virtual void AnchorUpdated() {}
93 93
94 // Called from GetAccessibleState, must return a valid accessible name. 94 // Called from GetAccessibleState, must return a valid accessible name.
95 virtual base::string16 GetAccessibleNameForTray() = 0; 95 virtual base::string16 GetAccessibleNameForTray() = 0;
96 96
97 // Called when the bubble is resized. 97 // Called when the bubble is resized.
98 virtual void BubbleResized(const views::TrayBubbleView* bubble_view) {} 98 virtual void BubbleResized(const views::TrayBubbleView* bubble_view) {}
99 99
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 // Returns true when the the background was overridden to be drawn as active. 137 // Returns true when the the background was overridden to be drawn as active.
138 bool draw_background_as_active() const {return draw_background_as_active_; } 138 bool draw_background_as_active() const {return draw_background_as_active_; }
139 139
140 StatusAreaWidget* status_area_widget() { 140 StatusAreaWidget* status_area_widget() {
141 return status_area_widget_; 141 return status_area_widget_;
142 } 142 }
143 const StatusAreaWidget* status_area_widget() const { 143 const StatusAreaWidget* status_area_widget() const {
144 return status_area_widget_; 144 return status_area_widget_;
145 } 145 }
146 TrayContainer* tray_container() const { return tray_container_; } 146 TrayContainer* tray_container() const { return tray_container_; }
147 ShelfAlignment shelf_alignment() const { return shelf_alignment_; } 147 wm::ShelfAlignment shelf_alignment() const { return shelf_alignment_; }
148 TrayEventFilter* tray_event_filter() { return tray_event_filter_.get(); } 148 TrayEventFilter* tray_event_filter() { return tray_event_filter_.get(); }
149 149
150 ShelfLayoutManager* GetShelfLayoutManager(); 150 ShelfLayoutManager* GetShelfLayoutManager();
151 151
152 // Updates the arrow visibility based on the launcher visibility. 152 // Updates the arrow visibility based on the launcher visibility.
153 void UpdateBubbleViewArrow(views::TrayBubbleView* bubble_view); 153 void UpdateBubbleViewArrow(views::TrayBubbleView* bubble_view);
154 154
155 private: 155 private:
156 class TrayWidgetObserver; 156 class TrayWidgetObserver;
157 157
158 // Called from Initialize after all status area trays have been created. 158 // Called from Initialize after all status area trays have been created.
159 // Sets the border based on the position of the view. 159 // Sets the border based on the position of the view.
160 void SetTrayBorder(); 160 void SetTrayBorder();
161 161
162 // ui::ImplicitAnimationObserver: 162 // ui::ImplicitAnimationObserver:
163 void OnImplicitAnimationsCompleted() override; 163 void OnImplicitAnimationsCompleted() override;
164 bool RequiresNotificationWhenAnimatorDestroyed() const override; 164 bool RequiresNotificationWhenAnimatorDestroyed() const override;
165 165
166 // Applies transformations to the |layer()| to animate the view when 166 // Applies transformations to the |layer()| to animate the view when
167 // SetVisible(false) is called. 167 // SetVisible(false) is called.
168 void HideTransformation(); 168 void HideTransformation();
169 169
170 // Unowned pointer to parent widget. 170 // Unowned pointer to parent widget.
171 StatusAreaWidget* status_area_widget_; 171 StatusAreaWidget* status_area_widget_;
172 172
173 // Convenience pointer to the contents view. 173 // Convenience pointer to the contents view.
174 TrayContainer* tray_container_; 174 TrayContainer* tray_container_;
175 175
176 // Shelf alignment. 176 // Shelf alignment.
177 ShelfAlignment shelf_alignment_; 177 wm::ShelfAlignment shelf_alignment_;
178 178
179 // Owned by the view passed to SetContents(). 179 // Owned by the view passed to SetContents().
180 TrayBackground* background_; 180 TrayBackground* background_;
181 181
182 // Animators for the background. They are only used for the old shelf layout. 182 // Animators for the background. They are only used for the old shelf layout.
183 BackgroundAnimator hide_background_animator_; 183 BackgroundAnimator hide_background_animator_;
184 BackgroundAnimator hover_background_animator_; 184 BackgroundAnimator hover_background_animator_;
185 185
186 // True if the background gets hovered. 186 // True if the background gets hovered.
187 bool hovered_; 187 bool hovered_;
188 188
189 // This variable stores the activation override which will tint the background 189 // This variable stores the activation override which will tint the background
190 // differently if set to true. 190 // differently if set to true.
191 bool draw_background_as_active_; 191 bool draw_background_as_active_;
192 192
193 std::unique_ptr<TrayWidgetObserver> widget_observer_; 193 std::unique_ptr<TrayWidgetObserver> widget_observer_;
194 std::unique_ptr<TrayEventFilter> tray_event_filter_; 194 std::unique_ptr<TrayEventFilter> tray_event_filter_;
195 195
196 DISALLOW_COPY_AND_ASSIGN(TrayBackgroundView); 196 DISALLOW_COPY_AND_ASSIGN(TrayBackgroundView);
197 }; 197 };
198 198
199 } // namespace ash 199 } // namespace ash
200 200
201 #endif // ASH_SYSTEM_TRAY_TRAY_BACKGROUND_VIEW_H_ 201 #endif // ASH_SYSTEM_TRAY_TRAY_BACKGROUND_VIEW_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698