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

Side by Side Diff: chrome/browser/chromeos/policy/browser_policy_connector_chromeos.cc

Issue 1306183007: Switch to id-based affiliation determination (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/browser_policy_connector_chromeos.h" 5 #include "chrome/browser/chromeos/policy/browser_policy_connector_chromeos.h"
6 6
7 #include <string> 7 #include <string>
8 #include "base/bind.h" 8 #include "base/bind.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
277 } 277 }
278 278
279 EnrollmentConfig BrowserPolicyConnectorChromeOS::GetPrescribedEnrollmentConfig() 279 EnrollmentConfig BrowserPolicyConnectorChromeOS::GetPrescribedEnrollmentConfig()
280 const { 280 const {
281 if (device_cloud_policy_initializer_) 281 if (device_cloud_policy_initializer_)
282 return device_cloud_policy_initializer_->GetPrescribedEnrollmentConfig(); 282 return device_cloud_policy_initializer_->GetPrescribedEnrollmentConfig();
283 283
284 return EnrollmentConfig(); 284 return EnrollmentConfig();
285 } 285 }
286 286
287 UserAffiliation BrowserPolicyConnectorChromeOS::GetUserAffiliation(
288 const std::string& user_name) {
289 // An empty username means incognito user in case of ChromiumOS and
290 // no logged-in user in case of Chromium (SigninService). Many tests use
291 // nonsense email addresses (e.g. 'test') so treat those as non-enterprise
292 // users.
293 if (user_name.empty() || user_name.find('@') == std::string::npos)
294 return USER_AFFILIATION_NONE;
295
296 if (install_attributes_ &&
297 (gaia::ExtractDomainName(gaia::CanonicalizeEmail(user_name)) ==
298 install_attributes_->GetDomain() ||
299 policy::IsDeviceLocalAccountUser(user_name, NULL))) {
300 return USER_AFFILIATION_MANAGED;
301 }
302
303 return USER_AFFILIATION_NONE;
304 }
305
306 void BrowserPolicyConnectorChromeOS::SetUserPolicyDelegate( 287 void BrowserPolicyConnectorChromeOS::SetUserPolicyDelegate(
307 ConfigurationPolicyProvider* user_policy_provider) { 288 ConfigurationPolicyProvider* user_policy_provider) {
308 global_user_cloud_policy_provider_->SetDelegate(user_policy_provider); 289 global_user_cloud_policy_provider_->SetDelegate(user_policy_provider);
309 } 290 }
310 291
311 void BrowserPolicyConnectorChromeOS::SetConsumerManagementServiceForTesting( 292 void BrowserPolicyConnectorChromeOS::SetConsumerManagementServiceForTesting(
312 scoped_ptr<ConsumerManagementService> service) { 293 scoped_ptr<ConsumerManagementService> service) {
313 consumer_management_service_ = service.Pass(); 294 consumer_management_service_ = service.Pass();
314 } 295 }
315 296
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
398 device_cloud_policy_manager_->device_store()->policy(); 379 device_cloud_policy_manager_->device_store()->policy();
399 if (policy_data) { 380 if (policy_data) {
400 affiliation_ids.insert(policy_data->device_affiliation_ids().begin(), 381 affiliation_ids.insert(policy_data->device_affiliation_ids().begin(),
401 policy_data->device_affiliation_ids().end()); 382 policy_data->device_affiliation_ids().end());
402 } 383 }
403 } 384 }
404 return affiliation_ids; 385 return affiliation_ids;
405 } 386 }
406 387
407 } // namespace policy 388 } // namespace policy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698