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_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 "ash/ash_export.h" | 8 #include "ash/ash_export.h" |
9 #include "ash/shelf/background_animator.h" | 9 #include "ash/shelf/background_animator.h" |
10 #include "ash/shelf/shelf_types.h" | 10 #include "ash/shelf/shelf_types.h" |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
117 | 117 |
118 // Returns the anchor rect for the bubble. | 118 // Returns the anchor rect for the bubble. |
119 gfx::Rect GetBubbleAnchorRect( | 119 gfx::Rect GetBubbleAnchorRect( |
120 views::Widget* anchor_widget, | 120 views::Widget* anchor_widget, |
121 views::TrayBubbleView::AnchorType anchor_type, | 121 views::TrayBubbleView::AnchorType anchor_type, |
122 views::TrayBubbleView::AnchorAlignment anchor_alignment) const; | 122 views::TrayBubbleView::AnchorAlignment anchor_alignment) const; |
123 | 123 |
124 // Returns the bubble anchor alignment based on |shelf_alignment_|. | 124 // Returns the bubble anchor alignment based on |shelf_alignment_|. |
125 views::TrayBubbleView::AnchorAlignment GetAnchorAlignment() const; | 125 views::TrayBubbleView::AnchorAlignment GetAnchorAlignment() const; |
126 | 126 |
127 // Updates the view visual based on the visibility of the bubble. | 127 // Forces the background to be drawn active if set to true. |
128 void SetBubbleVisible(bool visible); | 128 void SetDrawBackgroundAsActive(bool visible); |
| 129 |
| 130 // Returns true when the the background was overridden to be drawn as active. |
| 131 bool draw_background_as_active() const {return draw_background_as_active_; } |
129 | 132 |
130 StatusAreaWidget* status_area_widget() { | 133 StatusAreaWidget* status_area_widget() { |
131 return status_area_widget_; | 134 return status_area_widget_; |
132 } | 135 } |
133 const StatusAreaWidget* status_area_widget() const { | 136 const StatusAreaWidget* status_area_widget() const { |
134 return status_area_widget_; | 137 return status_area_widget_; |
135 } | 138 } |
136 TrayContainer* tray_container() const { return tray_container_; } | 139 TrayContainer* tray_container() const { return tray_container_; } |
137 ShelfAlignment shelf_alignment() const { return shelf_alignment_; } | 140 ShelfAlignment shelf_alignment() const { return shelf_alignment_; } |
138 TrayEventFilter* tray_event_filter() { return tray_event_filter_.get(); } | 141 TrayEventFilter* tray_event_filter() { return tray_event_filter_.get(); } |
139 | 142 |
140 ShelfLayoutManager* GetShelfLayoutManager(); | 143 ShelfLayoutManager* GetShelfLayoutManager(); |
141 | 144 |
142 // Updates the arrow visibilty based on the launcher visibilty. | 145 // Updates the arrow visibility based on the launcher visibility. |
143 void UpdateBubbleViewArrow(views::TrayBubbleView* bubble_view); | 146 void UpdateBubbleViewArrow(views::TrayBubbleView* bubble_view); |
144 | 147 |
145 // Provides the background with a function to query for pressed state. | |
146 virtual bool IsPressed(); | |
147 | |
148 private: | 148 private: |
149 class TrayWidgetObserver; | 149 class TrayWidgetObserver; |
150 | 150 |
151 // Called from Initialize after all status area trays have been created. | 151 // Called from Initialize after all status area trays have been created. |
152 // Sets the border based on the position of the view. | 152 // Sets the border based on the position of the view. |
153 void SetBorder(); | 153 void SetBorder(); |
154 | 154 |
155 // Unowned pointer to parent widget. | 155 // Unowned pointer to parent widget. |
156 StatusAreaWidget* status_area_widget_; | 156 StatusAreaWidget* status_area_widget_; |
157 | 157 |
158 // Convenience pointer to the contents view. | 158 // Convenience pointer to the contents view. |
159 TrayContainer* tray_container_; | 159 TrayContainer* tray_container_; |
160 | 160 |
161 // Shelf alignment. | 161 // Shelf alignment. |
162 ShelfAlignment shelf_alignment_; | 162 ShelfAlignment shelf_alignment_; |
163 | 163 |
164 // Owned by the view passed to SetContents(). | 164 // Owned by the view passed to SetContents(). |
165 internal::TrayBackground* background_; | 165 internal::TrayBackground* background_; |
166 | 166 |
| 167 // Animators for the background. They are only used for the old shelf layout. |
167 internal::BackgroundAnimator hide_background_animator_; | 168 internal::BackgroundAnimator hide_background_animator_; |
168 internal::BackgroundAnimator hover_background_animator_; | 169 internal::BackgroundAnimator hover_background_animator_; |
| 170 |
| 171 // True if the background gets hovered. |
169 bool hovered_; | 172 bool hovered_; |
170 bool pressed_; | 173 |
| 174 // This variable stores the activation override which will tint the background |
| 175 // differently if set to true. |
| 176 bool draw_background_as_active_; |
| 177 |
171 scoped_ptr<TrayWidgetObserver> widget_observer_; | 178 scoped_ptr<TrayWidgetObserver> widget_observer_; |
172 scoped_ptr<TrayEventFilter> tray_event_filter_; | 179 scoped_ptr<TrayEventFilter> tray_event_filter_; |
173 | 180 |
174 DISALLOW_COPY_AND_ASSIGN(TrayBackgroundView); | 181 DISALLOW_COPY_AND_ASSIGN(TrayBackgroundView); |
175 }; | 182 }; |
176 | 183 |
177 } // namespace internal | 184 } // namespace internal |
178 } // namespace ash | 185 } // namespace ash |
179 | 186 |
180 #endif // ASH_SYSTEM_TRAY_TRAY_BACKGROUND_VIEW_H_ | 187 #endif // ASH_SYSTEM_TRAY_TRAY_BACKGROUND_VIEW_H_ |
OLD | NEW |