| 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" |
| 11 #include "base/message_pump_observer.h" |
| 11 #include "base/timer.h" | 12 #include "base/timer.h" |
| 12 #include "ui/views/bubble/bubble_delegate.h" | 13 #include "ui/views/bubble/bubble_delegate.h" |
| 13 #include "ui/views/widget/widget.h" | 14 #include "ui/views/widget/widget.h" |
| 14 | 15 |
| 15 #include <vector> | 16 #include <vector> |
| 16 | 17 |
| 17 namespace ash { | 18 namespace ash { |
| 18 | 19 |
| 19 class SystemTray; | 20 class SystemTray; |
| 20 class SystemTrayItem; | 21 class SystemTrayItem; |
| (...skipping 29 matching lines...) Expand all Loading... |
| 50 virtual gfx::Size GetPreferredSize() OVERRIDE; | 51 virtual gfx::Size GetPreferredSize() OVERRIDE; |
| 51 virtual void OnMouseEntered(const views::MouseEvent& event) OVERRIDE; | 52 virtual void OnMouseEntered(const views::MouseEvent& event) OVERRIDE; |
| 52 virtual void OnMouseExited(const views::MouseEvent& event) OVERRIDE; | 53 virtual void OnMouseExited(const views::MouseEvent& event) OVERRIDE; |
| 53 | 54 |
| 54 SystemTrayBubble* host_; | 55 SystemTrayBubble* host_; |
| 55 bool can_activate_; | 56 bool can_activate_; |
| 56 | 57 |
| 57 DISALLOW_COPY_AND_ASSIGN(SystemTrayBubbleView); | 58 DISALLOW_COPY_AND_ASSIGN(SystemTrayBubbleView); |
| 58 }; | 59 }; |
| 59 | 60 |
| 60 class SystemTrayBubble : public views::Widget::Observer { | 61 class SystemTrayBubble : public base::MessagePumpObserver, |
| 62 public views::Widget::Observer { |
| 61 public: | 63 public: |
| 62 enum BubbleType { | 64 enum BubbleType { |
| 63 BUBBLE_TYPE_DEFAULT, | 65 BUBBLE_TYPE_DEFAULT, |
| 64 BUBBLE_TYPE_DETAILED, | 66 BUBBLE_TYPE_DETAILED, |
| 65 BUBBLE_TYPE_NOTIFICATION | 67 BUBBLE_TYPE_NOTIFICATION |
| 66 }; | 68 }; |
| 67 | 69 |
| 68 enum AnchorType { | 70 enum AnchorType { |
| 69 ANCHOR_TYPE_TRAY, | 71 ANCHOR_TYPE_TRAY, |
| 70 ANCHOR_TYPE_BUBBLE | 72 ANCHOR_TYPE_BUBBLE |
| (...skipping 29 matching lines...) Expand all Loading... |
| 100 | 102 |
| 101 void DestroyItemViews(); | 103 void DestroyItemViews(); |
| 102 void StartAutoCloseTimer(int seconds); | 104 void StartAutoCloseTimer(int seconds); |
| 103 void StopAutoCloseTimer(); | 105 void StopAutoCloseTimer(); |
| 104 void RestartAutoCloseTimer(); | 106 void RestartAutoCloseTimer(); |
| 105 void Close(); | 107 void Close(); |
| 106 | 108 |
| 107 private: | 109 private: |
| 108 void CreateItemViews(user::LoginStatus login_status); | 110 void CreateItemViews(user::LoginStatus login_status); |
| 109 | 111 |
| 112 // Overridden from base::MessagePumpObserver. |
| 113 virtual base::EventStatus WillProcessEvent( |
| 114 const base::NativeEvent& event) OVERRIDE; |
| 115 virtual void DidProcessEvent(const base::NativeEvent& event) OVERRIDE; |
| 110 // Overridden from views::Widget::Observer. | 116 // Overridden from views::Widget::Observer. |
| 111 virtual void OnWidgetClosing(views::Widget* widget) OVERRIDE; | 117 virtual void OnWidgetClosing(views::Widget* widget) OVERRIDE; |
| 118 virtual void OnWidgetVisibilityChanged(views::Widget* widget, |
| 119 bool visible) OVERRIDE; |
| 112 | 120 |
| 113 ash::SystemTray* tray_; | 121 ash::SystemTray* tray_; |
| 114 SystemTrayBubbleView* bubble_view_; | 122 SystemTrayBubbleView* bubble_view_; |
| 115 views::Widget* bubble_widget_; | 123 views::Widget* bubble_widget_; |
| 116 std::vector<ash::SystemTrayItem*> items_; | 124 std::vector<ash::SystemTrayItem*> items_; |
| 117 BubbleType bubble_type_; | 125 BubbleType bubble_type_; |
| 118 AnchorType anchor_type_; | 126 AnchorType anchor_type_; |
| 119 | 127 |
| 120 int autoclose_delay_; | 128 int autoclose_delay_; |
| 121 base::OneShotTimer<SystemTrayBubble> autoclose_; | 129 base::OneShotTimer<SystemTrayBubble> autoclose_; |
| 122 | 130 |
| 123 DISALLOW_COPY_AND_ASSIGN(SystemTrayBubble); | 131 DISALLOW_COPY_AND_ASSIGN(SystemTrayBubble); |
| 124 }; | 132 }; |
| 125 | 133 |
| 126 } // namespace internal | 134 } // namespace internal |
| 127 } // namespace ash | 135 } // namespace ash |
| 128 | 136 |
| 129 #endif // ASH_SYSTEM_TRAY_SYSTEM_TRAY_BUBBLE_H_ | 137 #endif // ASH_SYSTEM_TRAY_SYSTEM_TRAY_BUBBLE_H_ |
| OLD | NEW |