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_SYSTEM_TRAY_BUBBLE_H_ | 5 #ifndef ASH_SYSTEM_TRAY_SYSTEM_TRAY_BUBBLE_H_ |
6 #define ASH_SYSTEM_TRAY_SYSTEM_TRAY_BUBBLE_H_ | 6 #define ASH_SYSTEM_TRAY_SYSTEM_TRAY_BUBBLE_H_ |
7 #pragma once | 7 #pragma once |
8 | 8 |
9 #include "ash/system/user/login_status.h" | 9 #include "ash/system/user/login_status.h" |
10 #include "base/base_export.h" | 10 #include "base/base_export.h" |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
68 enum AnchorType { | 68 enum AnchorType { |
69 ANCHOR_TYPE_TRAY, | 69 ANCHOR_TYPE_TRAY, |
70 ANCHOR_TYPE_BUBBLE | 70 ANCHOR_TYPE_BUBBLE |
71 }; | 71 }; |
72 | 72 |
73 SystemTrayBubble(ash::SystemTray* tray, | 73 SystemTrayBubble(ash::SystemTray* tray, |
74 const std::vector<ash::SystemTrayItem*>& items, | 74 const std::vector<ash::SystemTrayItem*>& items, |
75 BubbleType bubble_type); | 75 BubbleType bubble_type); |
76 virtual ~SystemTrayBubble(); | 76 virtual ~SystemTrayBubble(); |
77 | 77 |
| 78 // Change the items displayed in the bubble. |
| 79 void UpdateView(const std::vector<ash::SystemTrayItem*>& items, |
| 80 BubbleType bubble_type); |
| 81 |
78 // Creates |bubble_view_| and a child views for each member of |items_|. | 82 // Creates |bubble_view_| and a child views for each member of |items_|. |
79 // Also creates |bubble_widget_| and sets up animations. | 83 // Also creates |bubble_widget_| and sets up animations. |
80 void InitView(views::View* anchor, | 84 void InitView(views::View* anchor, |
81 AnchorType anchor_type, | 85 AnchorType anchor_type, |
82 bool can_activate, | 86 bool can_activate, |
83 ash::user::LoginStatus login_status); | 87 ash::user::LoginStatus login_status); |
84 | 88 |
85 gfx::Rect GetAnchorRect() const; | 89 gfx::Rect GetAnchorRect() const; |
86 | 90 |
87 BubbleType bubble_type() const { return bubble_type_; } | 91 BubbleType bubble_type() const { return bubble_type_; } |
88 SystemTrayBubbleView* bubble_view() const { return bubble_view_; } | 92 SystemTrayBubbleView* bubble_view() const { return bubble_view_; } |
89 | 93 |
90 void DestroyItemViews(); | 94 void DestroyItemViews(); |
91 void StartAutoCloseTimer(int seconds); | 95 void StartAutoCloseTimer(int seconds); |
92 void StopAutoCloseTimer(); | 96 void StopAutoCloseTimer(); |
93 void RestartAutoCloseTimer(); | 97 void RestartAutoCloseTimer(); |
94 void Close(); | 98 void Close(); |
95 | 99 |
96 private: | 100 private: |
| 101 void CreateItemViews(user::LoginStatus login_status); |
| 102 |
97 // Overridden from base::MessagePumpObserver. | 103 // Overridden from base::MessagePumpObserver. |
98 virtual base::EventStatus WillProcessEvent( | 104 virtual base::EventStatus WillProcessEvent( |
99 const base::NativeEvent& event) OVERRIDE; | 105 const base::NativeEvent& event) OVERRIDE; |
100 virtual void DidProcessEvent(const base::NativeEvent& event) OVERRIDE; | 106 virtual void DidProcessEvent(const base::NativeEvent& event) OVERRIDE; |
101 // Overridden from views::Widget::Observer. | 107 // Overridden from views::Widget::Observer. |
102 virtual void OnWidgetClosing(views::Widget* widget) OVERRIDE; | 108 virtual void OnWidgetClosing(views::Widget* widget) OVERRIDE; |
103 virtual void OnWidgetVisibilityChanged(views::Widget* widget, | 109 virtual void OnWidgetVisibilityChanged(views::Widget* widget, |
104 bool visible) OVERRIDE; | 110 bool visible) OVERRIDE; |
105 | 111 |
106 ash::SystemTray* tray_; | 112 ash::SystemTray* tray_; |
107 SystemTrayBubbleView* bubble_view_; | 113 SystemTrayBubbleView* bubble_view_; |
108 views::Widget* bubble_widget_; | 114 views::Widget* bubble_widget_; |
109 std::vector<ash::SystemTrayItem*> items_; | 115 std::vector<ash::SystemTrayItem*> items_; |
110 BubbleType bubble_type_; | 116 BubbleType bubble_type_; |
111 AnchorType anchor_type_; | 117 AnchorType anchor_type_; |
112 | 118 |
113 int autoclose_delay_; | 119 int autoclose_delay_; |
114 base::OneShotTimer<SystemTrayBubble> autoclose_; | 120 base::OneShotTimer<SystemTrayBubble> autoclose_; |
115 | 121 |
116 DISALLOW_COPY_AND_ASSIGN(SystemTrayBubble); | 122 DISALLOW_COPY_AND_ASSIGN(SystemTrayBubble); |
117 }; | 123 }; |
118 | 124 |
119 } // namespace internal | 125 } // namespace internal |
120 } // namespace ash | 126 } // namespace ash |
121 | 127 |
122 #endif // ASH_SYSTEM_TRAY_SYSTEM_TRAY_BUBBLE_H_ | 128 #endif // ASH_SYSTEM_TRAY_SYSTEM_TRAY_BUBBLE_H_ |
OLD | NEW |