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 chromeos { | 10 namespace chromeos { |
(...skipping 19 matching lines...) Expand all Loading... | |
30 const std::string& device_path() const { return device_path_; } | 30 const std::string& device_path() const { return device_path_; } |
31 const std::string& state() const { return state_; } | 31 const std::string& state() const { return state_; } |
32 const std::string& error() const { return error_; } | 32 const std::string& error() const { return error_; } |
33 const std::string& activation_state() const { return activation_state_; } | 33 const std::string& activation_state() const { return activation_state_; } |
34 const std::string& roaming() const { return roaming_; } | 34 const std::string& roaming() const { return roaming_; } |
35 int signal_strength() const { return signal_strength_; } | 35 int signal_strength() const { return signal_strength_; } |
36 | 36 |
37 bool IsConnectedState() const; | 37 bool IsConnectedState() const; |
38 bool IsConnectingState() const; | 38 bool IsConnectingState() const; |
39 | 39 |
40 // Returns true if |type_| == |match_type|, or it matches one of the | |
41 // following special match types: | |
42 // * kMatchTypeDefault to match any network | |
pneubeck (no reviews)
2012/12/19 15:22:38
Why not call it kMatchTypeAny?
stevenjb
2012/12/19 18:01:07
I wanted to match the intention here; "Any" implie
pneubeck (no reviews)
2012/12/19 19:40:06
But First makes only sense in the context of the f
| |
43 // * kMatchTypeNonVirtual to match non virtual networks | |
44 // * kMatchTypeWireless to match wireless networks | |
45 bool MatchesType(const std::string& match_type) const; | |
46 | |
40 // Helpers (used e.g. when a state is cached) | 47 // Helpers (used e.g. when a state is cached) |
41 static bool StateIsConnected(const std::string& state); | 48 static bool StateIsConnected(const std::string& state); |
42 static bool StateIsConnecting(const std::string& state); | 49 static bool StateIsConnecting(const std::string& state); |
43 | 50 |
51 static const char kMatchTypeDefault[]; | |
52 static const char kMatchTypeWireless[]; | |
53 static const char kMatchTypeNonVirtual[]; | |
54 | |
44 private: | 55 private: |
45 friend class NetworkStateHandler; | 56 friend class NetworkStateHandler; |
46 | 57 |
47 // Called by NetworkStateHandler when the ip config changes. | 58 // Called by NetworkStateHandler when the ip config changes. |
48 void set_ip_address(const std::string& ip_address) { | 59 void set_ip_address(const std::string& ip_address) { |
49 ip_address_ = ip_address; | 60 ip_address_ = ip_address; |
50 } | 61 } |
51 | 62 |
52 // Common Network Service properties | 63 // Common Network Service properties |
53 std::string security_; | 64 std::string security_; |
54 std::string device_path_; | 65 std::string device_path_; |
55 std::string ip_address_; | 66 std::string ip_address_; |
56 std::string state_; | 67 std::string state_; |
57 std::string error_; | 68 std::string error_; |
58 // Wireless properties | 69 // Wireless properties |
59 int signal_strength_; | 70 int signal_strength_; |
60 // Cellular properties | 71 // Cellular properties |
61 std::string technology_; | 72 std::string technology_; |
62 std::string activation_state_; | 73 std::string activation_state_; |
63 std::string roaming_; | 74 std::string roaming_; |
64 | 75 |
65 DISALLOW_COPY_AND_ASSIGN(NetworkState); | 76 DISALLOW_COPY_AND_ASSIGN(NetworkState); |
66 }; | 77 }; |
67 | 78 |
68 } // namespace chromeos | 79 } // namespace chromeos |
69 | 80 |
70 #endif // CHROMEOS_NETWORK_NETWORK_STATE_H_ | 81 #endif // CHROMEOS_NETWORK_NETWORK_STATE_H_ |
OLD | NEW |