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 "ash/wm/shelf_auto_hide_behavior.h" | 10 #include "ash/wm/shelf_auto_hide_behavior.h" |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 virtual void Init() OVERRIDE; | 47 virtual void Init() OVERRIDE; |
48 virtual gfx::Rect GetAnchorRect() OVERRIDE; | 48 virtual gfx::Rect GetAnchorRect() OVERRIDE; |
49 // Overridden from views::View. | 49 // Overridden from views::View. |
50 virtual void ChildPreferredSizeChanged(View* child) OVERRIDE; | 50 virtual void ChildPreferredSizeChanged(View* child) OVERRIDE; |
51 virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; | 51 virtual void GetAccessibleState(ui::AccessibleViewState* state) OVERRIDE; |
52 virtual bool CanActivate() const OVERRIDE; | 52 virtual bool CanActivate() const OVERRIDE; |
53 virtual gfx::Size GetPreferredSize() OVERRIDE; | 53 virtual gfx::Size GetPreferredSize() OVERRIDE; |
54 virtual void OnMouseEntered(const views::MouseEvent& event) OVERRIDE; | 54 virtual void OnMouseEntered(const views::MouseEvent& event) OVERRIDE; |
55 virtual void OnMouseExited(const views::MouseEvent& event) OVERRIDE; | 55 virtual void OnMouseExited(const views::MouseEvent& event) OVERRIDE; |
56 | 56 |
| 57 void set_max_height(int height) { max_height_ = height; } |
| 58 |
57 SystemTrayBubble* host_; | 59 SystemTrayBubble* host_; |
58 bool can_activate_; | 60 bool can_activate_; |
| 61 int max_height_; |
59 | 62 |
60 DISALLOW_COPY_AND_ASSIGN(SystemTrayBubbleView); | 63 DISALLOW_COPY_AND_ASSIGN(SystemTrayBubbleView); |
61 }; | 64 }; |
62 | 65 |
63 class SystemTrayBubble : public base::MessagePumpObserver, | 66 class SystemTrayBubble : public base::MessagePumpObserver, |
64 public views::Widget::Observer { | 67 public views::Widget::Observer { |
65 public: | 68 public: |
66 enum BubbleType { | 69 enum BubbleType { |
67 BUBBLE_TYPE_DEFAULT, | 70 BUBBLE_TYPE_DEFAULT, |
68 BUBBLE_TYPE_DETAILED, | 71 BUBBLE_TYPE_DETAILED, |
69 BUBBLE_TYPE_NOTIFICATION | 72 BUBBLE_TYPE_NOTIFICATION |
70 }; | 73 }; |
71 | 74 |
72 enum AnchorType { | 75 enum AnchorType { |
73 ANCHOR_TYPE_TRAY, | 76 ANCHOR_TYPE_TRAY, |
74 ANCHOR_TYPE_BUBBLE | 77 ANCHOR_TYPE_BUBBLE |
75 }; | 78 }; |
76 | 79 |
77 struct InitParams { | 80 struct InitParams { |
78 InitParams(AnchorType anchor_type, ShelfAlignment shelf_alignmen); | 81 InitParams(AnchorType anchor_type, ShelfAlignment shelf_alignmen); |
79 | 82 |
80 views::View* anchor; | 83 views::View* anchor; |
81 AnchorType anchor_type; | 84 AnchorType anchor_type; |
82 bool can_activate; | 85 bool can_activate; |
83 ash::user::LoginStatus login_status; | 86 ash::user::LoginStatus login_status; |
84 int arrow_offset; | 87 int arrow_offset; |
| 88 int max_height; |
85 }; | 89 }; |
86 | 90 |
87 SystemTrayBubble(ash::SystemTray* tray, | 91 SystemTrayBubble(ash::SystemTray* tray, |
88 const std::vector<ash::SystemTrayItem*>& items, | 92 const std::vector<ash::SystemTrayItem*>& items, |
89 BubbleType bubble_type); | 93 BubbleType bubble_type); |
90 virtual ~SystemTrayBubble(); | 94 virtual ~SystemTrayBubble(); |
91 | 95 |
92 // Change the items displayed in the bubble. | 96 // Change the items displayed in the bubble. |
93 void UpdateView(const std::vector<ash::SystemTrayItem*>& items, | 97 void UpdateView(const std::vector<ash::SystemTrayItem*>& items, |
94 BubbleType bubble_type); | 98 BubbleType bubble_type); |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 int autoclose_delay_; | 134 int autoclose_delay_; |
131 base::OneShotTimer<SystemTrayBubble> autoclose_; | 135 base::OneShotTimer<SystemTrayBubble> autoclose_; |
132 | 136 |
133 DISALLOW_COPY_AND_ASSIGN(SystemTrayBubble); | 137 DISALLOW_COPY_AND_ASSIGN(SystemTrayBubble); |
134 }; | 138 }; |
135 | 139 |
136 } // namespace internal | 140 } // namespace internal |
137 } // namespace ash | 141 } // namespace ash |
138 | 142 |
139 #endif // ASH_SYSTEM_TRAY_SYSTEM_TRAY_BUBBLE_H_ | 143 #endif // ASH_SYSTEM_TRAY_SYSTEM_TRAY_BUBBLE_H_ |
OLD | NEW |