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_CHROMEOS_NETWORK_TRAY_VPN_H | 5 #ifndef ASH_SYSTEM_CHROMEOS_NETWORK_TRAY_VPN_H |
6 #define ASH_SYSTEM_CHROMEOS_NETWORK_TRAY_VPN_H | 6 #define ASH_SYSTEM_CHROMEOS_NETWORK_TRAY_VPN_H |
7 | 7 |
8 #include "ash/system/chromeos/network/network_observer.h" | 8 #include "ash/system/chromeos/network/network_observer.h" |
| 9 #include "ash/system/chromeos/network/tray_network_state_observer.h" |
9 #include "ash/system/tray/system_tray_item.h" | 10 #include "ash/system/tray/system_tray_item.h" |
10 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
11 | 12 |
12 namespace ash { | 13 namespace ash { |
13 namespace internal { | 14 namespace internal { |
14 | 15 |
| 16 class TrayNetworkStateObserver; |
| 17 |
15 namespace tray { | 18 namespace tray { |
16 class NetworkDetailedView; | 19 class NetworkDetailedView; |
17 class VpnDefaultView; | 20 class VpnDefaultView; |
18 class VpnDetailedView; | 21 class VpnDetailedView; |
19 } | 22 } |
20 | 23 |
21 class TrayVPN : public SystemTrayItem, | 24 class TrayVPN : public SystemTrayItem, |
22 public NetworkObserver { | 25 public NetworkObserver, |
| 26 public TrayNetworkStateObserver::Delegate { |
23 public: | 27 public: |
24 explicit TrayVPN(SystemTray* system_tray); | 28 explicit TrayVPN(SystemTray* system_tray); |
25 virtual ~TrayVPN(); | 29 virtual ~TrayVPN(); |
26 | 30 |
27 // Overridden from SystemTrayItem. | 31 // SystemTrayItem |
28 virtual views::View* CreateTrayView(user::LoginStatus status) OVERRIDE; | 32 virtual views::View* CreateTrayView(user::LoginStatus status) OVERRIDE; |
29 virtual views::View* CreateDefaultView(user::LoginStatus status) OVERRIDE; | 33 virtual views::View* CreateDefaultView(user::LoginStatus status) OVERRIDE; |
30 virtual views::View* CreateDetailedView(user::LoginStatus status) OVERRIDE; | 34 virtual views::View* CreateDetailedView(user::LoginStatus status) OVERRIDE; |
31 virtual views::View* CreateNotificationView( | 35 virtual views::View* CreateNotificationView( |
32 user::LoginStatus status) OVERRIDE; | 36 user::LoginStatus status) OVERRIDE; |
33 virtual void DestroyTrayView() OVERRIDE; | 37 virtual void DestroyTrayView() OVERRIDE; |
34 virtual void DestroyDefaultView() OVERRIDE; | 38 virtual void DestroyDefaultView() OVERRIDE; |
35 virtual void DestroyDetailedView() OVERRIDE; | 39 virtual void DestroyDetailedView() OVERRIDE; |
36 virtual void DestroyNotificationView() OVERRIDE; | 40 virtual void DestroyNotificationView() OVERRIDE; |
37 virtual void UpdateAfterLoginStatusChange(user::LoginStatus status) OVERRIDE; | 41 virtual void UpdateAfterLoginStatusChange(user::LoginStatus status) OVERRIDE; |
38 virtual void UpdateAfterShelfAlignmentChange( | 42 virtual void UpdateAfterShelfAlignmentChange( |
39 ShelfAlignment alignment) OVERRIDE; | 43 ShelfAlignment alignment) OVERRIDE; |
40 | 44 |
41 // Overridden from NetworkObserver. | 45 // NetworkObserver |
42 virtual void OnNetworkRefresh(const NetworkIconInfo& info) OVERRIDE; | 46 virtual void OnNetworkRefresh(const NetworkIconInfo& info) OVERRIDE; |
43 virtual void SetNetworkMessage(NetworkTrayDelegate* delegate, | 47 virtual void SetNetworkMessage(NetworkTrayDelegate* delegate, |
44 MessageType message_type, | 48 MessageType message_type, |
45 NetworkType network_type, | 49 NetworkType network_type, |
46 const string16& title, | 50 const string16& title, |
47 const string16& message, | 51 const string16& message, |
48 const std::vector<string16>& links) OVERRIDE; | 52 const std::vector<string16>& links) OVERRIDE; |
49 virtual void ClearNetworkMessage(MessageType message_type) OVERRIDE; | 53 virtual void ClearNetworkMessage(MessageType message_type) OVERRIDE; |
50 virtual void OnWillToggleWifi() OVERRIDE; | 54 virtual void OnWillToggleWifi() OVERRIDE; |
51 | 55 |
| 56 // TrayNetworkStateObserver::Delegate |
| 57 virtual void NetworkStateChanged(bool list_changed) OVERRIDE; |
| 58 virtual void NetworkServiceChanged( |
| 59 const chromeos::NetworkState* network) OVERRIDE; |
| 60 |
52 private: | 61 private: |
53 tray::VpnDefaultView* default_; | 62 tray::VpnDefaultView* default_; |
54 tray::NetworkDetailedView* detailed_; | 63 tray::NetworkDetailedView* detailed_; |
| 64 scoped_ptr<TrayNetworkStateObserver> network_state_observer_; |
55 | 65 |
56 DISALLOW_COPY_AND_ASSIGN(TrayVPN); | 66 DISALLOW_COPY_AND_ASSIGN(TrayVPN); |
57 }; | 67 }; |
58 | 68 |
59 } // namespace internal | 69 } // namespace internal |
60 } // namespace ash | 70 } // namespace ash |
61 | 71 |
62 #endif // ASH_SYSTEM_CHROMEOS_NETWORK_TRAY_VPN_H | 72 #endif // ASH_SYSTEM_CHROMEOS_NETWORK_TRAY_VPN_H |
OLD | NEW |