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