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

Side by Side Diff: chrome/browser/policy/profile_policy_connector.cc

Issue 2945023002: Introduce profile for lock screen apps (Closed)
Patch Set: rebase Created 3 years, 5 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
OLDNEW
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.h" 5 #include "chrome/browser/policy/profile_policy_connector.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 connector->GetDeviceActiveDirectoryPolicyManager()); 91 connector->GetDeviceActiveDirectoryPolicyManager());
92 } 92 }
93 #endif 93 #endif
94 94
95 if (configuration_policy_provider) 95 if (configuration_policy_provider)
96 policy_providers_.push_back(configuration_policy_provider); 96 policy_providers_.push_back(configuration_policy_provider);
97 97
98 #if defined(OS_CHROMEOS) 98 #if defined(OS_CHROMEOS)
99 if (!user) { 99 if (!user) {
100 DCHECK(schema_registry); 100 DCHECK(schema_registry);
101 // This case occurs for the signin profile. 101 // This case occurs for the signin and the lock screen app profiles.
102 special_user_policy_provider_.reset( 102 special_user_policy_provider_.reset(
103 new LoginProfilePolicyProvider(connector->GetPolicyService())); 103 new LoginProfilePolicyProvider(connector->GetPolicyService()));
104 } else { 104 } else {
105 // |user| should never be nullptr except for the signin profile. 105 // |user| should never be nullptr except for the signin and the lock screen
106 // app profile.
106 is_primary_user_ = 107 is_primary_user_ =
107 user == user_manager::UserManager::Get()->GetPrimaryUser(); 108 user == user_manager::UserManager::Get()->GetPrimaryUser();
108 // Note that |DeviceLocalAccountPolicyProvider::Create| returns nullptr when 109 // Note that |DeviceLocalAccountPolicyProvider::Create| returns nullptr when
109 // the user supplied is not a device-local account user. 110 // the user supplied is not a device-local account user.
110 special_user_policy_provider_ = DeviceLocalAccountPolicyProvider::Create( 111 special_user_policy_provider_ = DeviceLocalAccountPolicyProvider::Create(
111 user->GetAccountId().GetUserEmail(), 112 user->GetAccountId().GetUserEmail(),
112 connector->GetDeviceLocalAccountPolicyService(), force_immediate_load); 113 connector->GetDeviceLocalAccountPolicyService(), force_immediate_load);
113 } 114 }
114 if (special_user_policy_provider_) { 115 if (special_user_policy_provider_) {
115 special_user_policy_provider_->Init(schema_registry); 116 special_user_policy_provider_->Init(schema_registry);
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 const ConfigurationPolicyProvider* const provider = 173 const ConfigurationPolicyProvider* const provider =
173 DeterminePolicyProviderForPolicy(policy_key); 174 DeterminePolicyProviderForPolicy(policy_key);
174 return provider == configuration_policy_provider_; 175 return provider == configuration_policy_provider_;
175 } 176 }
176 177
177 const CloudPolicyStore* ProfilePolicyConnector::GetActualPolicyStore() const { 178 const CloudPolicyStore* ProfilePolicyConnector::GetActualPolicyStore() const {
178 if (policy_store_) 179 if (policy_store_)
179 return policy_store_; 180 return policy_store_;
180 #if defined(OS_CHROMEOS) 181 #if defined(OS_CHROMEOS)
181 if (special_user_policy_provider_) { 182 if (special_user_policy_provider_) {
182 // |special_user_policy_provider_| is non-null for device-local accounts and 183 // |special_user_policy_provider_| is non-null for device-local accounts,
183 // for the login profile. 184 // for the login profile, and the lock screen app profile.
184 const DeviceCloudPolicyManagerChromeOS* const device_cloud_policy_manager = 185 const DeviceCloudPolicyManagerChromeOS* const device_cloud_policy_manager =
185 g_browser_process->platform_part() 186 g_browser_process->platform_part()
186 ->browser_policy_connector_chromeos() 187 ->browser_policy_connector_chromeos()
187 ->GetDeviceCloudPolicyManager(); 188 ->GetDeviceCloudPolicyManager();
188 // The device_cloud_policy_manager can be a nullptr in unit tests. 189 // The device_cloud_policy_manager can be a nullptr in unit tests.
189 if (device_cloud_policy_manager) 190 if (device_cloud_policy_manager)
190 return device_cloud_policy_manager->core()->store(); 191 return device_cloud_policy_manager->core()->store();
191 } 192 }
192 #endif 193 #endif
193 return nullptr; 194 return nullptr;
194 } 195 }
195 196
196 const ConfigurationPolicyProvider* 197 const ConfigurationPolicyProvider*
197 ProfilePolicyConnector::DeterminePolicyProviderForPolicy( 198 ProfilePolicyConnector::DeterminePolicyProviderForPolicy(
198 const char* policy_key) const { 199 const char* policy_key) const {
199 const PolicyNamespace chrome_ns(POLICY_DOMAIN_CHROME, ""); 200 const PolicyNamespace chrome_ns(POLICY_DOMAIN_CHROME, "");
200 for (const ConfigurationPolicyProvider* provider : policy_providers_) { 201 for (const ConfigurationPolicyProvider* provider : policy_providers_) {
201 if (provider->policies().Get(chrome_ns).Get(policy_key)) 202 if (provider->policies().Get(chrome_ns).Get(policy_key))
202 return provider; 203 return provider;
203 } 204 }
204 return nullptr; 205 return nullptr;
205 } 206 }
206 207
207 } // namespace policy 208 } // namespace policy
OLDNEW
« no previous file with comments | « chrome/browser/metrics/chrome_metrics_service_client.cc ('k') | chrome/browser/policy/profile_policy_connector_factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698