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 "chromeos/network/managed_state.h" | 8 #include "chromeos/network/managed_state.h" |
9 | 9 |
| 10 namespace base { |
| 11 class DictionaryValue; |
| 12 } |
| 13 |
10 namespace chromeos { | 14 namespace chromeos { |
11 | 15 |
12 // Simple class to provide network state information about a network service. | 16 // Simple class to provide network state information about a network service. |
13 // This class should always be passed as a const* and should never be held | 17 // This class should always be passed as a const* and should never be held |
14 // on to. Store network_state->path() (defined in ManagedState) instead and | 18 // on to. Store network_state->path() (defined in ManagedState) instead and |
15 // call NetworkStateHandler::GetNetworkState(path) to retrieve the state for | 19 // call NetworkStateHandler::GetNetworkState(path) to retrieve the state for |
16 // the network. | 20 // the network. |
17 class CHROMEOS_EXPORT NetworkState : public ManagedState { | 21 class CHROMEOS_EXPORT NetworkState : public ManagedState { |
18 public: | 22 public: |
19 explicit NetworkState(const std::string& path); | 23 explicit NetworkState(const std::string& path); |
20 virtual ~NetworkState(); | 24 virtual ~NetworkState(); |
21 | 25 |
22 // ManagedState overrides | 26 // ManagedState overrides |
| 27 // If you change this method, update GetProperties too. |
23 virtual bool PropertyChanged(const std::string& key, | 28 virtual bool PropertyChanged(const std::string& key, |
24 const base::Value& value) OVERRIDE; | 29 const base::Value& value) OVERRIDE; |
25 | 30 |
| 31 // Fills |dictionary| with the state properties. All the properties that are |
| 32 // accepted by PropertyChanged are stored in |dictionary|, no other values are |
| 33 // stored. |
| 34 void GetProperties(base::DictionaryValue* dictionary) const; |
| 35 |
26 // Accessors | 36 // Accessors |
27 const std::string& security() const { return security_; } | 37 const std::string& security() const { return security_; } |
28 const std::string& ip_address() const { return ip_address_; } | 38 const std::string& ip_address() const { return ip_address_; } |
29 const std::string& device_path() const { return device_path_; } | 39 const std::string& device_path() const { return device_path_; } |
30 const std::string& guid() const { return guid_; } | 40 const std::string& guid() const { return guid_; } |
31 const std::string& connection_state() const { return connection_state_; } | 41 const std::string& connection_state() const { return connection_state_; } |
32 const std::string& error() const { return error_; } | 42 const std::string& error() const { return error_; } |
33 // Wireless property accessors | 43 // Wireless property accessors |
34 int signal_strength() const { return signal_strength_; } | 44 int signal_strength() const { return signal_strength_; } |
35 // Cellular property accessors | 45 // Cellular property accessors |
(...skipping 30 matching lines...) Expand all Loading... |
66 std::string technology_; | 76 std::string technology_; |
67 std::string activation_state_; | 77 std::string activation_state_; |
68 std::string roaming_; | 78 std::string roaming_; |
69 | 79 |
70 DISALLOW_COPY_AND_ASSIGN(NetworkState); | 80 DISALLOW_COPY_AND_ASSIGN(NetworkState); |
71 }; | 81 }; |
72 | 82 |
73 } // namespace chromeos | 83 } // namespace chromeos |
74 | 84 |
75 #endif // CHROMEOS_NETWORK_NETWORK_STATE_H_ | 85 #endif // CHROMEOS_NETWORK_NETWORK_STATE_H_ |
OLD | NEW |