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 "chrome/browser/chromeos/policy/user_network_configuration_updater_fact ory.h" | 5 #include "chrome/browser/chromeos/policy/user_network_configuration_updater_fact ory.h" |
6 | 6 |
7 #include "base/memory/singleton.h" | 7 #include "base/memory/singleton.h" |
8 #include "chrome/browser/chromeos/policy/user_network_configuration_updater.h" | 8 #include "chrome/browser/chromeos/policy/user_network_configuration_updater.h" |
9 #include "chrome/browser/chromeos/profiles/profile_helper.h" | 9 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
10 #include "chrome/browser/policy/profile_policy_connector.h" | 10 #include "chrome/browser/policy/profile_policy_connector.h" |
11 #include "chrome/browser/policy/profile_policy_connector_factory.h" | 11 #include "chrome/browser/policy/profile_policy_connector_factory.h" |
12 #include "chrome/browser/profiles/incognito_helpers.h" | 12 #include "chrome/browser/profiles/incognito_helpers.h" |
13 #include "chrome/browser/profiles/profile.h" | 13 #include "chrome/browser/profiles/profile.h" |
14 #include "chromeos/network/network_handler.h" | 14 #include "chromeos/network/network_handler.h" |
15 #include "components/keyed_service/content/browser_context_dependency_manager.h" | 15 #include "components/keyed_service/content/browser_context_dependency_manager.h" |
16 #include "components/policy/core/common/cloud/cloud_policy_constants.h" | 16 #include "components/policy/core/common/cloud/cloud_policy_constants.h" |
17 #include "components/user_manager/user.h" | 17 #include "components/user_manager/user.h" |
18 #include "components/user_manager/user_manager.h" | 18 #include "components/user_manager/user_manager.h" |
19 #include "components/user_manager/user_type.h" | 19 #include "components/user_manager/user_type.h" |
bartfab (slow)
2014/11/11 19:42:06
Nit: No longer used.
merkulova
2014/11/12 10:01:01
Done.
| |
20 | 20 |
21 namespace policy { | 21 namespace policy { |
22 | 22 |
23 // static | 23 // static |
24 UserNetworkConfigurationUpdater* | 24 UserNetworkConfigurationUpdater* |
25 UserNetworkConfigurationUpdaterFactory::GetForProfile(Profile* profile) { | 25 UserNetworkConfigurationUpdaterFactory::GetForProfile(Profile* profile) { |
26 return static_cast<UserNetworkConfigurationUpdater*>( | 26 return static_cast<UserNetworkConfigurationUpdater*>( |
27 GetInstance()->GetServiceForBrowserContext(profile, true)); | 27 GetInstance()->GetServiceForBrowserContext(profile, true)); |
28 } | 28 } |
29 | 29 |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
66 return NULL; // On the login screen only device network policies apply. | 66 return NULL; // On the login screen only device network policies apply. |
67 | 67 |
68 user_manager::User* user = | 68 user_manager::User* user = |
69 chromeos::ProfileHelper::Get()->GetUserByProfile(profile); | 69 chromeos::ProfileHelper::Get()->GetUserByProfile(profile); |
70 DCHECK(user); | 70 DCHECK(user); |
71 // Currently, only the network policy of the primary user is supported. See | 71 // Currently, only the network policy of the primary user is supported. See |
72 // also http://crbug.com/310685 . | 72 // also http://crbug.com/310685 . |
73 if (user != user_manager::UserManager::Get()->GetPrimaryUser()) | 73 if (user != user_manager::UserManager::Get()->GetPrimaryUser()) |
74 return NULL; | 74 return NULL; |
75 | 75 |
76 const bool allow_trusted_certs_from_policy = | 76 const bool allow_trusted_certs_from_policy = user->IsRegular(); |
77 user->GetType() == user_manager::USER_TYPE_REGULAR; | |
78 | 77 |
79 ProfilePolicyConnector* profile_connector = | 78 ProfilePolicyConnector* profile_connector = |
80 ProfilePolicyConnectorFactory::GetForProfile(profile); | 79 ProfilePolicyConnectorFactory::GetForProfile(profile); |
81 | 80 |
82 return UserNetworkConfigurationUpdater::CreateForUserPolicy( | 81 return UserNetworkConfigurationUpdater::CreateForUserPolicy( |
83 profile, | 82 profile, |
84 allow_trusted_certs_from_policy, | 83 allow_trusted_certs_from_policy, |
85 *user, | 84 *user, |
86 profile_connector->policy_service(), | 85 profile_connector->policy_service(), |
87 chromeos::NetworkHandler::Get()->managed_network_configuration_handler()) | 86 chromeos::NetworkHandler::Get()->managed_network_configuration_handler()) |
88 .release(); | 87 .release(); |
89 } | 88 } |
90 | 89 |
91 } // namespace policy | 90 } // namespace policy |
OLD | NEW |