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 "base/memory/scoped_ptr.h" | |
stevenjb
2013/03/05 17:59:18
Not needed
pneubeck (no reviews)
2013/03/07 15:53:02
Done.
| |
8 #include "chromeos/network/managed_state.h" | 9 #include "chromeos/network/managed_state.h" |
9 | 10 |
11 namespace base { | |
12 class DictionaryValue; | |
13 } | |
14 | |
10 namespace chromeos { | 15 namespace chromeos { |
11 | 16 |
12 // Simple class to provide network state information about a network service. | 17 // 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 | 18 // 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 | 19 // on to. Store network_state->path() (defined in ManagedState) instead and |
15 // call NetworkStateHandler::GetNetworkState(path) to retrieve the state for | 20 // call NetworkStateHandler::GetNetworkState(path) to retrieve the state for |
16 // the network. | 21 // the network. |
17 class CHROMEOS_EXPORT NetworkState : public ManagedState { | 22 class CHROMEOS_EXPORT NetworkState : public ManagedState { |
18 public: | 23 public: |
19 explicit NetworkState(const std::string& path); | 24 explicit NetworkState(const std::string& path); |
(...skipping 13 matching lines...) Expand all Loading... | |
33 // Wireless property accessors | 38 // Wireless property accessors |
34 int signal_strength() const { return signal_strength_; } | 39 int signal_strength() const { return signal_strength_; } |
35 // Cellular property accessors | 40 // Cellular property accessors |
36 const std::string& technology() const { return technology_; } | 41 const std::string& technology() const { return technology_; } |
37 const std::string& activation_state() const { return activation_state_; } | 42 const std::string& activation_state() const { return activation_state_; } |
38 const std::string& roaming() const { return roaming_; } | 43 const std::string& roaming() const { return roaming_; } |
39 | 44 |
40 bool IsConnectedState() const; | 45 bool IsConnectedState() const; |
41 bool IsConnectingState() const; | 46 bool IsConnectingState() const; |
42 | 47 |
48 // Fills |dictionary| with the state properties. This is the inverse function | |
49 // to PropertyChanged. | |
gauravsh
2013/03/05 21:04:56
How often do you anticipate this being used? Since
pneubeck (no reviews)
2013/03/07 15:53:02
By having this function in network_state.cc, we re
| |
50 void FillDictionary(base::DictionaryValue* dictionary) const; | |
gauravsh
2013/03/05 21:04:56
I'd prefer a less generic name - GetPropertyDictio
pneubeck (no reviews)
2013/03/07 15:53:02
Dictionary is already encoded in the type. Chose G
| |
51 | |
43 // Helpers (used e.g. when a state is cached) | 52 // Helpers (used e.g. when a state is cached) |
44 static bool StateIsConnected(const std::string& connection_state); | 53 static bool StateIsConnected(const std::string& connection_state); |
45 static bool StateIsConnecting(const std::string& connection_state); | 54 static bool StateIsConnecting(const std::string& connection_state); |
46 | 55 |
47 private: | 56 private: |
48 friend class NetworkStateHandler; | 57 friend class NetworkStateHandler; |
49 friend class NetworkChangeNotifierChromeosUpdateTest; | 58 friend class NetworkChangeNotifierChromeosUpdateTest; |
50 | 59 |
51 // Called by NetworkStateHandler when the ip config changes. | 60 // Called by NetworkStateHandler when the ip config changes. |
52 void set_ip_address(const std::string& ip_address) { | 61 void set_ip_address(const std::string& ip_address) { |
(...skipping 13 matching lines...) Expand all Loading... | |
66 std::string technology_; | 75 std::string technology_; |
67 std::string activation_state_; | 76 std::string activation_state_; |
68 std::string roaming_; | 77 std::string roaming_; |
69 | 78 |
70 DISALLOW_COPY_AND_ASSIGN(NetworkState); | 79 DISALLOW_COPY_AND_ASSIGN(NetworkState); |
71 }; | 80 }; |
72 | 81 |
73 } // namespace chromeos | 82 } // namespace chromeos |
74 | 83 |
75 #endif // CHROMEOS_NETWORK_NETWORK_STATE_H_ | 84 #endif // CHROMEOS_NETWORK_NETWORK_STATE_H_ |
OLD | NEW |