| 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 CHROMEOS_NETWORK_NETWORK_STATE_H_ | 5 #ifndef CHROMEOS_NETWORK_NETWORK_STATE_H_ |
| 6 #define CHROMEOS_NETWORK_NETWORK_STATE_H_ | 6 #define CHROMEOS_NETWORK_NETWORK_STATE_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/values.h" | 11 #include "base/values.h" |
| 12 #include "chromeos/network/managed_state.h" | 12 #include "chromeos/network/managed_state.h" |
| 13 #include "chromeos/network/onc/onc_constants.h" | 13 #include "chromeos/network/onc/onc_constants.h" |
| 14 | 14 |
| 15 namespace chromeos { | 15 namespace chromeos { |
| 16 | 16 |
| 17 // Simple class to provide network state information about a network service. | 17 // Simple class to provide network state information about a network service. |
| 18 // This class should always be passed as a const* and should never be held | 18 // This class should always be passed as a const* and should never be held |
| 19 // on to. Store network_state->path() (defined in ManagedState) instead and | 19 // on to. Store network_state->path() (defined in ManagedState) instead and |
| 20 // call NetworkStateHandler::GetNetworkState(path) to retrieve the state for | 20 // call NetworkStateHandler::GetNetworkState(path) to retrieve the state for |
| 21 // the network. | 21 // the network. |
| 22 class CHROMEOS_EXPORT NetworkState : public ManagedState { | 22 class CHROMEOS_EXPORT NetworkState : public ManagedState { |
| 23 public: | 23 public: |
| 24 typedef std::vector<int> FrequencyList; |
| 25 |
| 24 explicit NetworkState(const std::string& path); | 26 explicit NetworkState(const std::string& path); |
| 25 virtual ~NetworkState(); | 27 virtual ~NetworkState(); |
| 26 | 28 |
| 27 // ManagedState overrides | 29 // ManagedState overrides |
| 28 // If you change this method, update GetProperties too. | 30 // If you change this method, update GetProperties too. |
| 29 virtual bool PropertyChanged(const std::string& key, | 31 virtual bool PropertyChanged(const std::string& key, |
| 30 const base::Value& value) OVERRIDE; | 32 const base::Value& value) OVERRIDE; |
| 31 virtual void InitialPropertiesReceived() OVERRIDE; | 33 virtual void InitialPropertiesReceived() OVERRIDE; |
| 32 | 34 |
| 33 // Fills |dictionary| with the state properties. All the properties that are | 35 // Fills |dictionary| with the state properties. All the properties that are |
| (...skipping 18 matching lines...) Expand all Loading... |
| 52 bool auto_connect() const { return auto_connect_; } | 54 bool auto_connect() const { return auto_connect_; } |
| 53 bool favorite() const { return favorite_; } | 55 bool favorite() const { return favorite_; } |
| 54 int priority() const { return priority_; } | 56 int priority() const { return priority_; } |
| 55 const base::DictionaryValue& proxy_config() const { return proxy_config_; } | 57 const base::DictionaryValue& proxy_config() const { return proxy_config_; } |
| 56 onc::ONCSource onc_source() const { return onc_source_; } | 58 onc::ONCSource onc_source() const { return onc_source_; } |
| 57 // Wireless property accessors | 59 // Wireless property accessors |
| 58 int signal_strength() const { return signal_strength_; } | 60 int signal_strength() const { return signal_strength_; } |
| 59 bool connectable() const { return connectable_; } | 61 bool connectable() const { return connectable_; } |
| 60 // Wifi property accessors | 62 // Wifi property accessors |
| 61 bool passphrase_required() const { return passphrase_required_; } | 63 bool passphrase_required() const { return passphrase_required_; } |
| 64 const FrequencyList& wifi_frequencies() const { return wifi_frequencies_; } |
| 62 // Cellular property accessors | 65 // Cellular property accessors |
| 63 const std::string& technology() const { return technology_; } | 66 const std::string& technology() const { return technology_; } |
| 64 const std::string& activation_state() const { return activation_state_; } | 67 const std::string& activation_state() const { return activation_state_; } |
| 65 const std::string& roaming() const { return roaming_; } | 68 const std::string& roaming() const { return roaming_; } |
| 66 bool activate_over_non_cellular_networks() const { | 69 bool activate_over_non_cellular_networks() const { |
| 67 return activate_over_non_cellular_networks_; | 70 return activate_over_non_cellular_networks_; |
| 68 } | 71 } |
| 69 bool cellular_out_of_credits() const { return cellular_out_of_credits_; } | 72 bool cellular_out_of_credits() const { return cellular_out_of_credits_; } |
| 70 | 73 |
| 71 bool IsConnectedState() const; | 74 bool IsConnectedState() const; |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 117 // but are derived from the service's corresponding IPConfig object. | 120 // but are derived from the service's corresponding IPConfig object. |
| 118 std::string ip_address_; | 121 std::string ip_address_; |
| 119 std::vector<std::string> dns_servers_; | 122 std::vector<std::string> dns_servers_; |
| 120 // Wireless properties | 123 // Wireless properties |
| 121 int signal_strength_; | 124 int signal_strength_; |
| 122 bool connectable_; | 125 bool connectable_; |
| 123 // Wifi properties | 126 // Wifi properties |
| 124 std::string hex_ssid_; | 127 std::string hex_ssid_; |
| 125 std::string country_code_; | 128 std::string country_code_; |
| 126 bool passphrase_required_; | 129 bool passphrase_required_; |
| 130 FrequencyList wifi_frequencies_; |
| 127 // Cellular properties | 131 // Cellular properties |
| 128 std::string technology_; | 132 std::string technology_; |
| 129 std::string activation_state_; | 133 std::string activation_state_; |
| 130 std::string roaming_; | 134 std::string roaming_; |
| 131 bool activate_over_non_cellular_networks_; | 135 bool activate_over_non_cellular_networks_; |
| 132 bool cellular_out_of_credits_; | 136 bool cellular_out_of_credits_; |
| 133 | 137 |
| 134 DISALLOW_COPY_AND_ASSIGN(NetworkState); | 138 DISALLOW_COPY_AND_ASSIGN(NetworkState); |
| 135 }; | 139 }; |
| 136 | 140 |
| 137 } // namespace chromeos | 141 } // namespace chromeos |
| 138 | 142 |
| 139 #endif // CHROMEOS_NETWORK_NETWORK_STATE_H_ | 143 #endif // CHROMEOS_NETWORK_NETWORK_STATE_H_ |
| OLD | NEW |