Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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/policy/profile_policy_connector_factory.h" | 5 #include "chrome/browser/policy/profile_policy_connector_factory.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/memory/singleton.h" | 10 #include "base/memory/singleton.h" |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 100 | 100 |
| 101 const user_manager::User* user = nullptr; | 101 const user_manager::User* user = nullptr; |
| 102 SchemaRegistry* schema_registry = | 102 SchemaRegistry* schema_registry = |
| 103 SchemaRegistryServiceFactory::GetForContext(context)->registry(); | 103 SchemaRegistryServiceFactory::GetForContext(context)->registry(); |
| 104 | 104 |
| 105 ConfigurationPolicyProvider* policy_provider = nullptr; | 105 ConfigurationPolicyProvider* policy_provider = nullptr; |
| 106 const CloudPolicyStore* policy_store = nullptr; | 106 const CloudPolicyStore* policy_store = nullptr; |
| 107 | 107 |
| 108 #if defined(OS_CHROMEOS) | 108 #if defined(OS_CHROMEOS) |
| 109 Profile* const profile = Profile::FromBrowserContext(context); | 109 Profile* const profile = Profile::FromBrowserContext(context); |
| 110 if (!chromeos::ProfileHelper::IsSigninProfile(profile)) { | 110 if (!chromeos::ProfileHelper::IsSigninProfile(profile) && |
| 111 !chromeos::ProfileHelper::IsLockScreenAppProfile(profile)) { | |
| 111 user = chromeos::ProfileHelper::Get()->GetUserByProfile(profile); | 112 user = chromeos::ProfileHelper::Get()->GetUserByProfile(profile); |
| 112 CHECK(user); | 113 CHECK(user); |
| 113 } | 114 } |
| 114 | 115 |
| 115 CloudPolicyManager* user_cloud_policy_manager = | 116 CloudPolicyManager* user_cloud_policy_manager = |
| 116 UserPolicyManagerFactoryChromeOS::GetCloudPolicyManagerForProfile( | 117 UserPolicyManagerFactoryChromeOS::GetCloudPolicyManagerForProfile( |
| 117 profile); | 118 profile); |
| 118 ActiveDirectoryPolicyManager* active_directory_manager = | 119 ActiveDirectoryPolicyManager* active_directory_manager = |
| 119 UserPolicyManagerFactoryChromeOS:: | 120 UserPolicyManagerFactoryChromeOS:: |
| 120 GetActiveDirectoryPolicyManagerForProfile(profile); | 121 GetActiveDirectoryPolicyManagerForProfile(profile); |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 131 if (user_cloud_policy_manager) { | 132 if (user_cloud_policy_manager) { |
| 132 policy_provider = user_cloud_policy_manager; | 133 policy_provider = user_cloud_policy_manager; |
| 133 policy_store = user_cloud_policy_manager->core()->store(); | 134 policy_store = user_cloud_policy_manager->core()->store(); |
| 134 } | 135 } |
| 135 #endif // defined(OS_CHROMEOS) | 136 #endif // defined(OS_CHROMEOS) |
| 136 | 137 |
| 137 std::unique_ptr<ProfilePolicyConnector> connector( | 138 std::unique_ptr<ProfilePolicyConnector> connector( |
| 138 new ProfilePolicyConnector()); | 139 new ProfilePolicyConnector()); |
| 139 | 140 |
| 140 if (test_providers_.empty()) { | 141 if (test_providers_.empty()) { |
| 141 connector->Init(user, schema_registry, policy_provider, policy_store, | 142 connector->Init(user, schema_registry, policy_provider, policy_store, |
|
emaxx
2017/06/23 16:16:30
nit: Please update the comments to mention the new
emaxx
2017/06/23 16:16:30
A DCHECK will be hit there if an incognito profile
tbarzic
2017/06/23 17:18:40
Done.
tbarzic
2017/06/23 17:18:40
Yes, that's correct.
(And CreateForBrowserContext
| |
| 142 force_immediate_load); | 143 force_immediate_load); |
| 143 } else { | 144 } else { |
| 144 PolicyServiceImpl::Providers providers; | 145 PolicyServiceImpl::Providers providers; |
| 145 providers.push_back(test_providers_.front()); | 146 providers.push_back(test_providers_.front()); |
| 146 test_providers_.pop_front(); | 147 test_providers_.pop_front(); |
| 147 std::unique_ptr<PolicyService> service(new PolicyServiceImpl(providers)); | 148 std::unique_ptr<PolicyService> service(new PolicyServiceImpl(providers)); |
| 148 connector->InitForTesting(std::move(service)); | 149 connector->InitForTesting(std::move(service)); |
| 149 } | 150 } |
| 150 | 151 |
| 151 connectors_[context] = connector.get(); | 152 connectors_[context] = connector.get(); |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 174 | 175 |
| 175 bool ProfilePolicyConnectorFactory::HasTestingFactory( | 176 bool ProfilePolicyConnectorFactory::HasTestingFactory( |
| 176 content::BrowserContext* context) { | 177 content::BrowserContext* context) { |
| 177 return false; | 178 return false; |
| 178 } | 179 } |
| 179 | 180 |
| 180 void ProfilePolicyConnectorFactory::CreateServiceNow( | 181 void ProfilePolicyConnectorFactory::CreateServiceNow( |
| 181 content::BrowserContext* context) {} | 182 content::BrowserContext* context) {} |
| 182 | 183 |
| 183 } // namespace policy | 184 } // namespace policy |
| OLD | NEW |