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/launcher/background_animator.h" | 9 #include "ash/launcher/background_animator.h" |
10 #include "ash/system/tray/tray_bubble_view.h" | |
11 #include "ash/system/tray/tray_views.h" | 10 #include "ash/system/tray/tray_views.h" |
12 #include "ash/wm/shelf_types.h" | 11 #include "ash/wm/shelf_types.h" |
| 12 #include "ui/views/bubble/tray_bubble_view.h" |
13 | 13 |
14 namespace ash { | 14 namespace ash { |
15 namespace internal { | 15 namespace internal { |
16 | 16 |
17 class ShelfLayoutManager; | 17 class ShelfLayoutManager; |
18 class StatusAreaWidget; | 18 class StatusAreaWidget; |
19 class TrayBackground; | 19 class TrayBackground; |
20 // Base class for children of StatusAreaWidget: SystemTray, WebNotificationTray. | 20 // Base class for children of StatusAreaWidget: SystemTray, WebNotificationTray. |
21 // This class handles setting and animating the background when the Launcher | 21 // This class handles setting and animating the background when the Launcher |
22 // his shown/hidden. It also inherits from ActionableView so that the tray | 22 // his shown/hidden. It also inherits from ActionableView so that the tray |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 virtual void SetShelfAlignment(ShelfAlignment alignment); | 80 virtual void SetShelfAlignment(ShelfAlignment alignment); |
81 | 81 |
82 // Called when the anchor (tray or bubble) may have moved or changed. | 82 // Called when the anchor (tray or bubble) may have moved or changed. |
83 virtual void AnchorUpdated() {} | 83 virtual void AnchorUpdated() {} |
84 | 84 |
85 // Called from GetAccessibleState, must return a valid accessible name. | 85 // Called from GetAccessibleState, must return a valid accessible name. |
86 virtual string16 GetAccessibleNameForTray() = 0; | 86 virtual string16 GetAccessibleNameForTray() = 0; |
87 | 87 |
88 // Hides the bubble associated with |bubble_view|. Called when the widget | 88 // Hides the bubble associated with |bubble_view|. Called when the widget |
89 // is closed. | 89 // is closed. |
90 virtual void HideBubbleWithView( | 90 virtual void HideBubbleWithView(const views::TrayBubbleView* bubble_view) = 0; |
91 const message_center::TrayBubbleView* bubble_view) = 0; | |
92 | 91 |
93 // Called by the bubble wrapper when a click event occurs outside the bubble. | 92 // Called by the bubble wrapper when a click event occurs outside the bubble. |
94 // May close the bubble. Returns true if the event is handled. | 93 // May close the bubble. Returns true if the event is handled. |
95 virtual bool ClickedOutsideBubble() = 0; | 94 virtual bool ClickedOutsideBubble() = 0; |
96 | 95 |
97 // Sets |contents| as a child. | 96 // Sets |contents| as a child. |
98 void SetContents(views::View* contents); | 97 void SetContents(views::View* contents); |
99 | 98 |
100 // Creates and sets contents background to |background_|. | 99 // Creates and sets contents background to |background_|. |
101 void SetContentsBackground(); | 100 void SetContentsBackground(); |
102 | 101 |
103 // Sets whether the tray paints a background. Default is true, but is set to | 102 // Sets whether the tray paints a background. Default is true, but is set to |
104 // false if a window overlaps the shelf. | 103 // false if a window overlaps the shelf. |
105 void SetPaintsBackground( | 104 void SetPaintsBackground( |
106 bool value, | 105 bool value, |
107 internal::BackgroundAnimator::ChangeType change_type); | 106 internal::BackgroundAnimator::ChangeType change_type); |
108 | 107 |
109 // Initializes animations for the bubble. | 108 // Initializes animations for the bubble. |
110 void InitializeBubbleAnimations(views::Widget* bubble_widget); | 109 void InitializeBubbleAnimations(views::Widget* bubble_widget); |
111 | 110 |
112 // Returns the window hosting the bubble. | 111 // Returns the window hosting the bubble. |
113 aura::Window* GetBubbleWindowContainer() const; | 112 aura::Window* GetBubbleWindowContainer() const; |
114 | 113 |
115 // Returns the anchor rect for the bubble. | 114 // Returns the anchor rect for the bubble. |
116 gfx::Rect GetBubbleAnchorRect( | 115 gfx::Rect GetBubbleAnchorRect( |
117 views::Widget* anchor_widget, | 116 views::Widget* anchor_widget, |
118 message_center::TrayBubbleView::AnchorType anchor_type, | 117 views::TrayBubbleView::AnchorType anchor_type, |
119 message_center::TrayBubbleView::AnchorAlignment anchor_alignment) const; | 118 views::TrayBubbleView::AnchorAlignment anchor_alignment) const; |
120 | 119 |
121 // Returns the bubble anchor alignment based on |shelf_alignment_|. | 120 // Returns the bubble anchor alignment based on |shelf_alignment_|. |
122 message_center::TrayBubbleView::AnchorAlignment GetAnchorAlignment() const; | 121 views::TrayBubbleView::AnchorAlignment GetAnchorAlignment() const; |
123 | 122 |
124 StatusAreaWidget* status_area_widget() { | 123 StatusAreaWidget* status_area_widget() { |
125 return status_area_widget_; | 124 return status_area_widget_; |
126 } | 125 } |
127 const StatusAreaWidget* status_area_widget() const { | 126 const StatusAreaWidget* status_area_widget() const { |
128 return status_area_widget_; | 127 return status_area_widget_; |
129 } | 128 } |
130 TrayContainer* tray_container() const { return tray_container_; } | 129 TrayContainer* tray_container() const { return tray_container_; } |
131 ShelfAlignment shelf_alignment() const { return shelf_alignment_; } | 130 ShelfAlignment shelf_alignment() const { return shelf_alignment_; } |
132 | 131 |
133 ShelfLayoutManager* GetShelfLayoutManager(); | 132 ShelfLayoutManager* GetShelfLayoutManager(); |
134 | 133 |
| 134 // Updates the arrow visibilty based on the launcher visibilty. |
| 135 void UpdateBubbleViewArrow(views::TrayBubbleView* bubble_view); |
| 136 |
135 private: | 137 private: |
136 class TrayWidgetObserver; | 138 class TrayWidgetObserver; |
137 | 139 |
138 // Called from Initialize after all status area trays have been created. | 140 // Called from Initialize after all status area trays have been created. |
139 // Sets the border based on the position of the view. | 141 // Sets the border based on the position of the view. |
140 void SetBorder(); | 142 void SetBorder(); |
141 | 143 |
142 // Unowned pointer to parent widget. | 144 // Unowned pointer to parent widget. |
143 StatusAreaWidget* status_area_widget_; | 145 StatusAreaWidget* status_area_widget_; |
144 | 146 |
(...skipping 10 matching lines...) Expand all Loading... |
155 internal::BackgroundAnimator hover_background_animator_; | 157 internal::BackgroundAnimator hover_background_animator_; |
156 scoped_ptr<TrayWidgetObserver> widget_observer_; | 158 scoped_ptr<TrayWidgetObserver> widget_observer_; |
157 | 159 |
158 DISALLOW_COPY_AND_ASSIGN(TrayBackgroundView); | 160 DISALLOW_COPY_AND_ASSIGN(TrayBackgroundView); |
159 }; | 161 }; |
160 | 162 |
161 } // namespace internal | 163 } // namespace internal |
162 } // namespace ash | 164 } // namespace ash |
163 | 165 |
164 #endif // ASH_SYSTEM_TRAY_TRAY_BACKGROUND_VIEW_H_ | 166 #endif // ASH_SYSTEM_TRAY_TRAY_BACKGROUND_VIEW_H_ |
OLD | NEW |