Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #ifndef CHROMEOS_NETWORK_NETWORK_STATE_H_ | |
| 6 #define CHROMEOS_NETWORK_NETWORK_STATE_H_ | |
| 7 | |
| 8 #include "chromeos/network/managed_state.h" | |
| 9 | |
| 10 // Simple class to provide network state information about a network service. | |
|
Greg Spencer (Chromium)
2012/10/23 23:19:10
Move inside of namespace just before class declara
stevenjb
2012/10/25 00:41:58
Done.
| |
| 11 // This class should always be passed as a const* and should never be held | |
| 12 // on to. Use path() (in ManagedState) for storing network identifiers and | |
| 13 // call NetworkStateManager::GetNetworkState(path) to retrieve the state for | |
| 14 // the network. | |
| 15 | |
| 16 namespace chromeos { | |
| 17 | |
| 18 class CHROMEOS_EXPORT NetworkState : public ManagedState { | |
| 19 public: | |
| 20 enum DataLeft { | |
|
Greg Spencer (Chromium)
2012/10/23 23:19:10
nit: Maybe "DataPlanRemaining"?
stevenjb
2012/10/25 00:41:58
Compromise: DataRemaing
| |
| 21 DATA_UNKNOWN, | |
| 22 DATA_NORMAL, | |
| 23 DATA_LOW, | |
| 24 DATA_VERY_LOW, | |
| 25 DATA_NONE | |
| 26 }; | |
| 27 | |
| 28 explicit NetworkState(const std::string& path); | |
| 29 | |
| 30 // Called by NetworkStateManager when a property changes. | |
| 31 virtual bool PropertyChanged(const std::string& key, | |
|
Greg Spencer (Chromium)
2012/10/23 23:19:10
Add which interface this overrides to the comment:
stevenjb
2012/10/25 00:41:58
Done.
| |
| 32 const base::Value& value) OVERRIDE; | |
| 33 | |
| 34 // Accessors | |
| 35 const std::string& name() const { return name_; } | |
| 36 const std::string& type() const { return type_; } | |
| 37 const std::string& security() const { return security_; } | |
| 38 const std::string& technology() const { return technology_; } | |
| 39 const std::string& ip_config() const { return ip_config_; } | |
| 40 const std::string& device_path() const { return device_path_; } | |
| 41 const std::string& state() const { return state_; } | |
| 42 const std::string& error() const { return error_; } | |
| 43 const std::string& activation() const { return activation_; } | |
| 44 const std::string& roaming() const { return roaming_; } | |
| 45 int strength() const { return strength_; } | |
| 46 DataLeft data_left() const { return data_left_; } | |
| 47 | |
| 48 bool IsConnectedState() const; | |
| 49 bool IsConnectingState() const; | |
| 50 | |
| 51 // Helpers (used e.g. when a state is cached). | |
| 52 static bool StateIsConnected(const std::string& state); | |
| 53 static bool StateIsConnecting(const std::string& state); | |
| 54 | |
| 55 private: | |
| 56 friend class NetworkStateManager; | |
| 57 | |
| 58 // Called by NetworkStateManager when the ip config changes. | |
| 59 void set_ip_config(const std::string& ip_config) {ip_config_ = ip_config; } | |
| 60 | |
| 61 // Network Service Properties | |
| 62 std::string name_; | |
| 63 std::string type_; | |
| 64 std::string security_; | |
| 65 std::string technology_; | |
| 66 std::string device_path_; | |
| 67 std::string ip_config_; | |
| 68 std::string state_; | |
| 69 std::string error_; | |
| 70 std::string activation_; | |
| 71 std::string roaming_; | |
| 72 int strength_; | |
| 73 DataLeft data_left_; | |
| 74 | |
| 75 DISALLOW_COPY_AND_ASSIGN(NetworkState); | |
| 76 }; | |
| 77 | |
| 78 } // namespace chromeos | |
| 79 | |
| 80 #endif // CHROMEOS_NETWORK_NETWORK_STATE_H_ | |
| OLD | NEW |