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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
61 BUBBLE_TYPE_DEFAULT, | 61 BUBBLE_TYPE_DEFAULT, |
62 BUBBLE_TYPE_DETAILED, | 62 BUBBLE_TYPE_DETAILED, |
63 BUBBLE_TYPE_NOTIFICATION | 63 BUBBLE_TYPE_NOTIFICATION |
64 }; | 64 }; |
65 | 65 |
66 enum AnchorType { | 66 enum AnchorType { |
67 ANCHOR_TYPE_TRAY, | 67 ANCHOR_TYPE_TRAY, |
68 ANCHOR_TYPE_BUBBLE | 68 ANCHOR_TYPE_BUBBLE |
69 }; | 69 }; |
70 | 70 |
| 71 struct InitParams { |
| 72 InitParams(AnchorType anchor_type); |
| 73 |
| 74 views::View* anchor; |
| 75 AnchorType anchor_type; |
| 76 bool can_activate; |
| 77 ash::user::LoginStatus login_status; |
| 78 int arrow_offset; |
| 79 }; |
| 80 |
71 SystemTrayBubble(ash::SystemTray* tray, | 81 SystemTrayBubble(ash::SystemTray* tray, |
72 const std::vector<ash::SystemTrayItem*>& items, | 82 const std::vector<ash::SystemTrayItem*>& items, |
73 BubbleType bubble_type); | 83 BubbleType bubble_type); |
74 virtual ~SystemTrayBubble(); | 84 virtual ~SystemTrayBubble(); |
75 | 85 |
76 // Change the items displayed in the bubble. | 86 // Change the items displayed in the bubble. |
77 void UpdateView(const std::vector<ash::SystemTrayItem*>& items, | 87 void UpdateView(const std::vector<ash::SystemTrayItem*>& items, |
78 BubbleType bubble_type); | 88 BubbleType bubble_type); |
79 | 89 |
80 // Creates |bubble_view_| and a child views for each member of |items_|. | 90 // Creates |bubble_view_| and a child views for each member of |items_|. |
81 // Also creates |bubble_widget_| and sets up animations. | 91 // Also creates |bubble_widget_| and sets up animations. |
82 void InitView(views::View* anchor, | 92 void InitView(const InitParams& init_params); |
83 AnchorType anchor_type, | |
84 bool can_activate, | |
85 ash::user::LoginStatus login_status); | |
86 | 93 |
87 gfx::Rect GetAnchorRect() const; | 94 gfx::Rect GetAnchorRect() const; |
88 | 95 |
89 BubbleType bubble_type() const { return bubble_type_; } | 96 BubbleType bubble_type() const { return bubble_type_; } |
90 SystemTrayBubbleView* bubble_view() const { return bubble_view_; } | 97 SystemTrayBubbleView* bubble_view() const { return bubble_view_; } |
91 | 98 |
92 void DestroyItemViews(); | 99 void DestroyItemViews(); |
93 void StartAutoCloseTimer(int seconds); | 100 void StartAutoCloseTimer(int seconds); |
94 void StopAutoCloseTimer(); | 101 void StopAutoCloseTimer(); |
95 void RestartAutoCloseTimer(); | 102 void RestartAutoCloseTimer(); |
(...skipping 15 matching lines...) Expand all Loading... |
111 int autoclose_delay_; | 118 int autoclose_delay_; |
112 base::OneShotTimer<SystemTrayBubble> autoclose_; | 119 base::OneShotTimer<SystemTrayBubble> autoclose_; |
113 | 120 |
114 DISALLOW_COPY_AND_ASSIGN(SystemTrayBubble); | 121 DISALLOW_COPY_AND_ASSIGN(SystemTrayBubble); |
115 }; | 122 }; |
116 | 123 |
117 } // namespace internal | 124 } // namespace internal |
118 } // namespace ash | 125 } // namespace ash |
119 | 126 |
120 #endif // ASH_SYSTEM_TRAY_SYSTEM_TRAY_BUBBLE_H_ | 127 #endif // ASH_SYSTEM_TRAY_SYSTEM_TRAY_BUBBLE_H_ |
OLD | NEW |