OLD | NEW |
---|---|
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 #include "chromeos/network/managed_network_configuration_handler_impl.h" | 5 #include "chromeos/network/managed_network_configuration_handler_impl.h" |
6 | 6 |
7 #include <memory> | 7 #include <memory> |
8 #include <utility> | 8 #include <utility> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
136 const std::string& userhash, | 136 const std::string& userhash, |
137 const network_handler::DictionaryResultCallback& callback, | 137 const network_handler::DictionaryResultCallback& callback, |
138 const network_handler::ErrorCallback& error_callback, | 138 const network_handler::ErrorCallback& error_callback, |
139 const std::string& service_path, | 139 const std::string& service_path, |
140 std::unique_ptr<base::DictionaryValue> shill_properties) { | 140 std::unique_ptr<base::DictionaryValue> shill_properties) { |
141 std::string profile_path; | 141 std::string profile_path; |
142 shill_properties->GetStringWithoutPathExpansion(shill::kProfileProperty, | 142 shill_properties->GetStringWithoutPathExpansion(shill::kProfileProperty, |
143 &profile_path); | 143 &profile_path); |
144 const NetworkProfile* profile = | 144 const NetworkProfile* profile = |
145 network_profile_handler_->GetProfileForPath(profile_path); | 145 network_profile_handler_->GetProfileForPath(profile_path); |
146 if (!profile) | 146 if (!profile && !onc::IsTetherShillDictionary(*shill_properties)) { |
stevenjb
2017/04/24 21:26:41
We should avoid putting IsTetherShillDictionary()
Kyle Horimoto
2017/04/25 01:18:32
Done.
| |
147 // Tether networks are not expected to have an associated profile; only | |
148 // log an error if the provided properties do not correspond to a | |
149 // Tether network. | |
147 NET_LOG_ERROR("No profile for service: " + profile_path, service_path); | 150 NET_LOG_ERROR("No profile for service: " + profile_path, service_path); |
151 } | |
148 | 152 |
149 std::unique_ptr<NetworkUIData> ui_data = | 153 std::unique_ptr<NetworkUIData> ui_data = |
150 shill_property_util::GetUIDataFromProperties(*shill_properties); | 154 shill_property_util::GetUIDataFromProperties(*shill_properties); |
151 | 155 |
152 const base::DictionaryValue* user_settings = NULL; | 156 const base::DictionaryValue* user_settings = nullptr; |
153 | 157 |
154 if (ui_data && profile) { | 158 if (ui_data && profile) { |
155 user_settings = ui_data->user_settings(); | 159 user_settings = ui_data->user_settings(); |
156 } else if (profile) { | 160 } else if (profile) { |
157 NET_LOG_DEBUG("Service contains empty or invalid UIData", service_path); | 161 NET_LOG_DEBUG("Service contains empty or invalid UIData", service_path); |
158 // TODO(pneubeck): add a conversion of user configured entries of old | 162 // TODO(pneubeck): add a conversion of user configured entries of old |
159 // ChromeOS versions. We will have to use a heuristic to determine which | 163 // ChromeOS versions. We will have to use a heuristic to determine which |
160 // properties _might_ be user configured. | 164 // properties _might_ be user configured. |
161 } | 165 } |
162 | 166 |
163 std::string guid; | 167 std::string guid; |
164 shill_properties->GetStringWithoutPathExpansion(shill::kGuidProperty, &guid); | 168 shill_properties->GetStringWithoutPathExpansion(shill::kGuidProperty, &guid); |
165 | 169 |
166 ::onc::ONCSource onc_source; | 170 ::onc::ONCSource onc_source; |
167 FindPolicyByGUID(userhash, guid, &onc_source); | 171 FindPolicyByGUID(userhash, guid, &onc_source); |
168 const NetworkState* network_state = | 172 const NetworkState* network_state = |
169 network_state_handler_->GetNetworkState(service_path); | 173 network_state_handler_->GetNetworkState(service_path); |
170 std::unique_ptr<base::DictionaryValue> active_settings( | 174 std::unique_ptr<base::DictionaryValue> active_settings( |
171 onc::TranslateShillServiceToONCPart(*shill_properties, onc_source, | 175 onc::TranslateShillServiceToONCPart(*shill_properties, onc_source, |
172 &onc::kNetworkWithStateSignature, | 176 &onc::kNetworkWithStateSignature, |
173 network_state)); | 177 network_state)); |
174 | 178 |
175 const base::DictionaryValue* network_policy = NULL; | 179 const base::DictionaryValue* network_policy = nullptr; |
176 const base::DictionaryValue* global_policy = NULL; | 180 const base::DictionaryValue* global_policy = nullptr; |
177 if (profile) { | 181 if (profile) { |
178 const Policies* policies = GetPoliciesForProfile(*profile); | 182 const Policies* policies = GetPoliciesForProfile(*profile); |
179 if (!policies) { | 183 if (!policies) { |
180 InvokeErrorCallback( | 184 InvokeErrorCallback( |
181 service_path, error_callback, kPoliciesNotInitialized); | 185 service_path, error_callback, kPoliciesNotInitialized); |
182 return; | 186 return; |
183 } | 187 } |
184 if (!guid.empty()) | 188 if (!guid.empty()) |
185 network_policy = GetByGUID(policies->per_network_config, guid); | 189 network_policy = GetByGUID(policies->per_network_config, guid); |
186 global_policy = &policies->global_network_config; | 190 global_policy = &policies->global_network_config; |
(...skipping 719 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
906 std::unique_ptr<base::DictionaryValue> network_properties, | 910 std::unique_ptr<base::DictionaryValue> network_properties, |
907 GetDevicePropertiesCallback send_callback, | 911 GetDevicePropertiesCallback send_callback, |
908 const std::string& error_name, | 912 const std::string& error_name, |
909 std::unique_ptr<base::DictionaryValue> error_data) { | 913 std::unique_ptr<base::DictionaryValue> error_data) { |
910 NET_LOG_ERROR("Error getting device properties", service_path); | 914 NET_LOG_ERROR("Error getting device properties", service_path); |
911 send_callback.Run(service_path, std::move(network_properties)); | 915 send_callback.Run(service_path, std::move(network_properties)); |
912 } | 916 } |
913 | 917 |
914 | 918 |
915 } // namespace chromeos | 919 } // namespace chromeos |
OLD | NEW |