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 #include "chrome/browser/chromeos/net/onc_utils.h" | 5 #include "chrome/browser/chromeos/net/onc_utils.h" |
6 | 6 |
7 #include "base/bind_helpers.h" | 7 #include "base/bind_helpers.h" |
8 #include "base/json/json_writer.h" | 8 #include "base/json/json_writer.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/prefs/pref_service.h" | 10 #include "base/prefs/pref_service.h" |
11 #include "base/values.h" | 11 #include "base/values.h" |
12 #include "chrome/browser/chromeos/login/users/user_manager.h" | |
13 #include "chrome/browser/chromeos/ui_proxy_config.h" | 12 #include "chrome/browser/chromeos/ui_proxy_config.h" |
14 #include "chrome/browser/prefs/proxy_config_dictionary.h" | 13 #include "chrome/browser/prefs/proxy_config_dictionary.h" |
15 #include "chrome/common/pref_names.h" | 14 #include "chrome/common/pref_names.h" |
16 #include "chromeos/network/managed_network_configuration_handler.h" | 15 #include "chromeos/network/managed_network_configuration_handler.h" |
17 #include "chromeos/network/network_configuration_handler.h" | 16 #include "chromeos/network/network_configuration_handler.h" |
18 #include "chromeos/network/network_handler.h" | 17 #include "chromeos/network/network_handler.h" |
19 #include "chromeos/network/network_profile.h" | 18 #include "chromeos/network/network_profile.h" |
20 #include "chromeos/network/network_profile_handler.h" | 19 #include "chromeos/network/network_profile_handler.h" |
21 #include "chromeos/network/network_state.h" | 20 #include "chromeos/network/network_state.h" |
22 #include "chromeos/network/network_state_handler.h" | 21 #include "chromeos/network/network_state_handler.h" |
23 #include "chromeos/network/network_ui_data.h" | 22 #include "chromeos/network/network_ui_data.h" |
24 #include "chromeos/network/onc/onc_normalizer.h" | 23 #include "chromeos/network/onc/onc_normalizer.h" |
25 #include "chromeos/network/onc/onc_signature.h" | 24 #include "chromeos/network/onc/onc_signature.h" |
26 #include "chromeos/network/onc/onc_translator.h" | 25 #include "chromeos/network/onc/onc_translator.h" |
27 #include "chromeos/network/onc/onc_utils.h" | 26 #include "chromeos/network/onc/onc_utils.h" |
28 #include "components/user_manager/user.h" | 27 #include "components/user_manager/user.h" |
| 28 #include "components/user_manager/user_manager.h" |
29 #include "net/base/host_port_pair.h" | 29 #include "net/base/host_port_pair.h" |
30 #include "net/proxy/proxy_bypass_rules.h" | 30 #include "net/proxy/proxy_bypass_rules.h" |
31 #include "net/proxy/proxy_server.h" | 31 #include "net/proxy/proxy_server.h" |
32 #include "third_party/cros_system_api/dbus/service_constants.h" | 32 #include "third_party/cros_system_api/dbus/service_constants.h" |
33 #include "url/gurl.h" | 33 #include "url/gurl.h" |
34 | 34 |
35 namespace chromeos { | 35 namespace chromeos { |
36 namespace onc { | 36 namespace onc { |
37 | 37 |
38 namespace { | 38 namespace { |
(...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
259 } | 259 } |
260 } | 260 } |
261 | 261 |
262 if (ethernet_not_found) | 262 if (ethernet_not_found) |
263 *error = "No Ethernet available to configure."; | 263 *error = "No Ethernet available to configure."; |
264 } | 264 } |
265 | 265 |
266 const base::DictionaryValue* FindPolicyForActiveUser( | 266 const base::DictionaryValue* FindPolicyForActiveUser( |
267 const std::string& guid, | 267 const std::string& guid, |
268 ::onc::ONCSource* onc_source) { | 268 ::onc::ONCSource* onc_source) { |
269 const user_manager::User* user = UserManager::Get()->GetActiveUser(); | 269 const user_manager::User* user = |
| 270 user_manager::UserManager::Get()->GetActiveUser(); |
270 std::string username_hash = user ? user->username_hash() : std::string(); | 271 std::string username_hash = user ? user->username_hash() : std::string(); |
271 return NetworkHandler::Get()->managed_network_configuration_handler()-> | 272 return NetworkHandler::Get()->managed_network_configuration_handler()-> |
272 FindPolicyByGUID(username_hash, guid, onc_source); | 273 FindPolicyByGUID(username_hash, guid, onc_source); |
273 } | 274 } |
274 | 275 |
275 const base::DictionaryValue* GetGlobalConfigFromPolicy(bool for_active_user) { | 276 const base::DictionaryValue* GetGlobalConfigFromPolicy(bool for_active_user) { |
276 std::string username_hash; | 277 std::string username_hash; |
277 if (for_active_user) { | 278 if (for_active_user) { |
278 const user_manager::User* user = UserManager::Get()->GetActiveUser(); | 279 const user_manager::User* user = |
| 280 user_manager::UserManager::Get()->GetActiveUser(); |
279 if (!user) { | 281 if (!user) { |
280 LOG(ERROR) << "No user logged in yet."; | 282 LOG(ERROR) << "No user logged in yet."; |
281 return NULL; | 283 return NULL; |
282 } | 284 } |
283 username_hash = user->username_hash(); | 285 username_hash = user->username_hash(); |
284 } | 286 } |
285 return NetworkHandler::Get()->managed_network_configuration_handler()-> | 287 return NetworkHandler::Get()->managed_network_configuration_handler()-> |
286 GetGlobalConfigFromPolicy(username_hash); | 288 GetGlobalConfigFromPolicy(username_hash); |
287 } | 289 } |
288 | 290 |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
448 const PrefService* local_state_prefs, | 450 const PrefService* local_state_prefs, |
449 const NetworkState& network) { | 451 const NetworkState& network) { |
450 ::onc::ONCSource ignored_onc_source; | 452 ::onc::ONCSource ignored_onc_source; |
451 const base::DictionaryValue* policy = onc::GetPolicyForNetwork( | 453 const base::DictionaryValue* policy = onc::GetPolicyForNetwork( |
452 profile_prefs, local_state_prefs, network, &ignored_onc_source); | 454 profile_prefs, local_state_prefs, network, &ignored_onc_source); |
453 return policy != NULL; | 455 return policy != NULL; |
454 } | 456 } |
455 | 457 |
456 } // namespace onc | 458 } // namespace onc |
457 } // namespace chromeos | 459 } // namespace chromeos |
OLD | NEW |