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_NETWORK_H | 5 #ifndef ASH_SYSTEM_CHROMEOS_NETWORK_TRAY_NETWORK_H |
6 #define ASH_SYSTEM_CHROMEOS_NETWORK_TRAY_NETWORK_H | 6 #define ASH_SYSTEM_CHROMEOS_NETWORK_TRAY_NETWORK_H |
7 | 7 |
| 8 #include <set> |
| 9 |
| 10 #include "ash/system/chromeos/network/network_icon.h" |
8 #include "ash/system/chromeos/network/network_observer.h" | 11 #include "ash/system/chromeos/network/network_observer.h" |
9 #include "ash/system/tray/system_tray_item.h" | 12 #include "ash/system/tray/system_tray_item.h" |
10 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
| 14 #include "base/time.h" |
| 15 |
| 16 namespace chromeos { |
| 17 class NetworkState; |
| 18 } |
11 | 19 |
12 namespace ash { | 20 namespace ash { |
13 namespace internal { | 21 namespace internal { |
14 | 22 |
15 class TrayNetworkStateObserver; | 23 class TrayNetworkStateObserver; |
16 | 24 |
17 namespace tray { | 25 namespace tray { |
18 class NetworkDefaultView; | 26 class NetworkDefaultView; |
19 class NetworkDetailedView; | 27 class NetworkDetailedView; |
20 class NetworkMessages; | 28 class NetworkMessages; |
(...skipping 29 matching lines...) Expand all Loading... |
50 virtual void OnNetworkRefresh(const NetworkIconInfo& info) OVERRIDE; | 58 virtual void OnNetworkRefresh(const NetworkIconInfo& info) OVERRIDE; |
51 virtual void SetNetworkMessage(NetworkTrayDelegate* delegate, | 59 virtual void SetNetworkMessage(NetworkTrayDelegate* delegate, |
52 MessageType message_type, | 60 MessageType message_type, |
53 NetworkType network_type, | 61 NetworkType network_type, |
54 const string16& title, | 62 const string16& title, |
55 const string16& message, | 63 const string16& message, |
56 const std::vector<string16>& links) OVERRIDE; | 64 const std::vector<string16>& links) OVERRIDE; |
57 virtual void ClearNetworkMessage(MessageType message_type) OVERRIDE; | 65 virtual void ClearNetworkMessage(MessageType message_type) OVERRIDE; |
58 virtual void OnWillToggleWifi() OVERRIDE; | 66 virtual void OnWillToggleWifi() OVERRIDE; |
59 | 67 |
60 private: | 68 // Called when the network for the tray icon may have been updated. |
| 69 void TrayNetworkUpdated(); |
| 70 |
| 71 // Called when the properties for |network| may have been updated. |
| 72 void NetworkServiceChanged(const chromeos::NetworkState* network); |
| 73 |
| 74 // Request a network connection (called from detailed view). |
| 75 void ConnectToNetwork(const std::string& service_path); |
| 76 |
| 77 // Returns true if a user initiated connection to |network| occured. |
| 78 bool HasConnectingNetwork(const std::string& service_path); |
| 79 |
| 80 // Gets the correct icon and label for |icon_type|. |
| 81 void GetNetworkStateHandlerImageAndLabel(network_icon::IconType icon_type, |
| 82 gfx::ImageSkia* image, |
| 83 string16* label); |
| 84 |
| 85 // Updates and returns the appropriate message id if a network technology |
| 86 // (i.e. cellular) is uninitialized. |
| 87 int GetUninitializedMsg(); |
| 88 |
| 89 private: |
61 friend class tray::NetworkMessageView; | 90 friend class tray::NetworkMessageView; |
62 friend class tray::NetworkNotificationView; | 91 friend class tray::NetworkNotificationView; |
63 | 92 |
64 void LinkClicked(MessageType message_type, int link_id); | 93 void LinkClicked(MessageType message_type, int link_id); |
65 | 94 |
66 const tray::NetworkMessages* messages() const { return messages_.get(); } | 95 const tray::NetworkMessages* messages() const { return messages_.get(); } |
67 | 96 |
68 tray::NetworkTrayView* tray_; | 97 tray::NetworkTrayView* tray_; |
69 tray::NetworkDefaultView* default_; | 98 tray::NetworkDefaultView* default_; |
70 tray::NetworkDetailedView* detailed_; | 99 tray::NetworkDetailedView* detailed_; |
71 tray::NetworkNotificationView* notification_; | 100 tray::NetworkNotificationView* notification_; |
72 scoped_ptr<tray::NetworkMessages> messages_; | 101 scoped_ptr<tray::NetworkMessages> messages_; |
73 bool request_wifi_view_; | 102 bool request_wifi_view_; |
74 scoped_ptr<TrayNetworkStateObserver> network_state_observer_; | 103 scoped_ptr<TrayNetworkStateObserver> network_state_observer_; |
| 104 std::set<std::string> connecting_networks_; |
| 105 base::Time uninitialized_state_time_; |
| 106 int uninitialized_msg_; |
75 | 107 |
76 DISALLOW_COPY_AND_ASSIGN(TrayNetwork); | 108 DISALLOW_COPY_AND_ASSIGN(TrayNetwork); |
77 }; | 109 }; |
78 | 110 |
79 } // namespace internal | 111 } // namespace internal |
80 } // namespace ash | 112 } // namespace ash |
81 | 113 |
82 #endif // ASH_SYSTEM_CHROMEOS_NETWORK_TRAY_NETWORK_H | 114 #endif // ASH_SYSTEM_CHROMEOS_NETWORK_TRAY_NETWORK_H |
OLD | NEW |