Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(114)

Side by Side Diff: chromeos/network/network_state.h

Issue 289383004: Merge FavoriteState into NetworkState (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Elim UpdateManagerProperties, feedback Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 "chromeos/network/managed_state.h" 12 #include "chromeos/network/managed_state.h"
12 #include "chromeos/network/network_ui_data.h" 13 #include "chromeos/network/network_ui_data.h"
13 #include "components/onc/onc_constants.h" 14 #include "components/onc/onc_constants.h"
14 #include "url/gurl.h" 15 #include "url/gurl.h"
15 16
16 namespace base { 17 namespace base {
17 class DictionaryValue; 18 class DictionaryValue;
18 class Value; 19 class Value;
19 } 20 }
20 21
(...skipping 17 matching lines...) Expand all
38 const base::DictionaryValue& properties) OVERRIDE; 39 const base::DictionaryValue& properties) OVERRIDE;
39 virtual void GetStateProperties( 40 virtual void GetStateProperties(
40 base::DictionaryValue* dictionary) const OVERRIDE; 41 base::DictionaryValue* dictionary) const OVERRIDE;
41 42
42 void IPConfigPropertiesChanged(const base::DictionaryValue& properties); 43 void IPConfigPropertiesChanged(const base::DictionaryValue& properties);
43 44
44 // Returns true, if the network requires a service activation. 45 // Returns true, if the network requires a service activation.
45 bool RequiresActivation() const; 46 bool RequiresActivation() const;
46 47
47 // Accessors 48 // Accessors
49 bool visible() const { return visible_; }
48 const std::string& security() const { return security_; } 50 const std::string& security() const { return security_; }
49 const std::string& device_path() const { return device_path_; } 51 const std::string& device_path() const { return device_path_; }
50 const std::string& guid() const { return guid_; } 52 const std::string& guid() const { return guid_; }
51 const std::string& connection_state() const { return connection_state_; } 53 const std::string& connection_state() const { return connection_state_; }
52 const std::string& profile_path() const { return profile_path_; } 54 const std::string& profile_path() const { return profile_path_; }
53 const std::string& error() const { return error_; } 55 const std::string& error() const { return error_; }
54 const std::string& last_error() const { return last_error_; } 56 const std::string& last_error() const { return last_error_; }
55 void clear_last_error() { last_error_.clear(); } 57 void clear_last_error() { last_error_.clear(); }
56 58
57 const NetworkUIData& ui_data() const { return ui_data_; } 59 const NetworkUIData& ui_data() const { return ui_data_; }
60 const base::DictionaryValue& proxy_config() const { return proxy_config_; }
58 61
59 // IPConfig Properties. These require an extra call to ShillIPConfigClient, 62 // IPConfig Properties. These require an extra call to ShillIPConfigClient,
60 // so cache them to avoid excessively complex client code. 63 // so cache them to avoid excessively complex client code.
61 const std::string& ip_address() const { return ip_address_; } 64 const std::string& ip_address() const { return ip_address_; }
62 const std::string& gateway() const { return gateway_; } 65 const std::string& gateway() const { return gateway_; }
63 const std::vector<std::string>& dns_servers() const { return dns_servers_; } 66 const std::vector<std::string>& dns_servers() const { return dns_servers_; }
64 const GURL& web_proxy_auto_discovery_url() const { 67 const GURL& web_proxy_auto_discovery_url() const {
65 return web_proxy_auto_discovery_url_; 68 return web_proxy_auto_discovery_url_;
66 } 69 }
67 70
(...skipping 15 matching lines...) Expand all
83 } 86 }
84 bool cellular_out_of_credits() const { return cellular_out_of_credits_; } 87 bool cellular_out_of_credits() const { return cellular_out_of_credits_; }
85 88
86 // Whether this network has a CACertNSS nickname set. 89 // Whether this network has a CACertNSS nickname set.
87 bool HasCACertNSS() const { return has_ca_cert_nss_; } 90 bool HasCACertNSS() const { return has_ca_cert_nss_; }
88 91
89 // Returns true if |connection_state_| is a connected/connecting state. 92 // Returns true if |connection_state_| is a connected/connecting state.
90 bool IsConnectedState() const; 93 bool IsConnectedState() const;
91 bool IsConnectingState() const; 94 bool IsConnectingState() const;
92 95
96 // Returns true if this is a network stored in a profile (see note above).
pneubeck (no reviews) 2014/06/11 12:44:56 the 'see note above' doesn't apply anymore. maybe
stevenjb 2014/06/11 23:31:41 Done.
97 bool IsInProfile() const;
98
93 // Returns true if the network properties are stored in a user profile. 99 // Returns true if the network properties are stored in a user profile.
94 bool IsPrivate() const; 100 bool IsPrivate() const;
95 101
96 // Returns a comma separated string of name servers. 102 // Returns a comma separated string of name servers.
97 std::string GetDnsServersAsString() const; 103 std::string GetDnsServersAsString() const;
98 104
99 // Converts the prefix length to a netmask string. 105 // Converts the prefix length to a netmask string.
100 std::string GetNetmask() const; 106 std::string GetNetmask() const;
101 107
108 // Returns a specifier for identifying this network in the absence of a GUID.
109 // This should only be used by NetworkStateHandler for keeping track of
110 // GUIDs assigned to unsaved networks.
111 std::string GetSpecifier() const;
112
102 // Set the GUID. Called exclusively by NetworkStateHandler. 113 // Set the GUID. Called exclusively by NetworkStateHandler.
103 void SetGuid(const std::string& guid); 114 void SetGuid(const std::string& guid);
104 115
105 // Helpers (used e.g. when a state or error is cached) 116 // Helpers (used e.g. when a state or error is cached)
106 static bool StateIsConnected(const std::string& connection_state); 117 static bool StateIsConnected(const std::string& connection_state);
107 static bool StateIsConnecting(const std::string& connection_state); 118 static bool StateIsConnecting(const std::string& connection_state);
108 static bool ErrorIsValid(const std::string& error); 119 static bool ErrorIsValid(const std::string& error);
109 120
110 private: 121 private:
111 friend class MobileActivatorTest; 122 friend class MobileActivatorTest;
112 friend class NetworkStateHandler; 123 friend class NetworkStateHandler;
113 friend class NetworkChangeNotifierChromeosUpdateTest; 124 friend class NetworkChangeNotifierChromeosUpdateTest;
114 125
115 // Updates |name_| from WiFi.HexSSID if provided, and validates |name_|. 126 // Updates |name_| from WiFi.HexSSID if provided, and validates |name_|.
116 // Returns true if |name_| changes. 127 // Returns true if |name_| changes.
117 bool UpdateName(const base::DictionaryValue& properties); 128 bool UpdateName(const base::DictionaryValue& properties);
118 129
130 void set_visible(bool visible) { visible_ = visible; }
131
132 // Set to true if the network is a member of Manager.Services.
133 bool visible_;
134
119 // Network Service properties. Avoid adding any additional properties here. 135 // Network Service properties. Avoid adding any additional properties here.
120 // Instead use NetworkConfigurationHandler::GetProperties() to asynchronously 136 // Instead use NetworkConfigurationHandler::GetProperties() to asynchronously
121 // request properties from Shill. 137 // request properties from Shill.
122 std::string security_; 138 std::string security_;
123 std::string eap_method_; // Needed for WiFi EAP networks 139 std::string eap_method_; // Needed for WiFi EAP networks
124 std::string device_path_; 140 std::string device_path_;
125 std::string guid_; 141 std::string guid_;
126 std::string connection_state_; 142 std::string connection_state_;
127 std::string profile_path_; 143 std::string profile_path_;
128 bool connectable_; 144 bool connectable_;
(...skipping 26 matching lines...) Expand all
155 std::string network_technology_; 171 std::string network_technology_;
156 std::string activation_state_; 172 std::string activation_state_;
157 std::string roaming_; 173 std::string roaming_;
158 bool activate_over_non_cellular_networks_; 174 bool activate_over_non_cellular_networks_;
159 bool cellular_out_of_credits_; 175 bool cellular_out_of_credits_;
160 176
161 // Whether a deprecated CaCertNSS property of this network is set. Required 177 // Whether a deprecated CaCertNSS property of this network is set. Required
162 // for migration to PEM. 178 // for migration to PEM.
163 bool has_ca_cert_nss_; 179 bool has_ca_cert_nss_;
164 180
181 // TODO(pneubeck): Remove this once (Managed)NetworkConfigurationHandler
182 // provides proxy configuration. crbug.com/241775
183 base::DictionaryValue proxy_config_;
184
165 DISALLOW_COPY_AND_ASSIGN(NetworkState); 185 DISALLOW_COPY_AND_ASSIGN(NetworkState);
166 }; 186 };
167 187
168 } // namespace chromeos 188 } // namespace chromeos
169 189
170 #endif // CHROMEOS_NETWORK_NETWORK_STATE_H_ 190 #endif // CHROMEOS_NETWORK_NETWORK_STATE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698