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

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

Issue 1165323004: We should use UserID object to identify users instead of username. Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 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 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 254 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 265
266 EnrollmentConfig BrowserPolicyConnectorChromeOS::GetPrescribedEnrollmentConfig() 266 EnrollmentConfig BrowserPolicyConnectorChromeOS::GetPrescribedEnrollmentConfig()
267 const { 267 const {
268 if (device_cloud_policy_initializer_) 268 if (device_cloud_policy_initializer_)
269 return device_cloud_policy_initializer_->GetPrescribedEnrollmentConfig(); 269 return device_cloud_policy_initializer_->GetPrescribedEnrollmentConfig();
270 270
271 return EnrollmentConfig(); 271 return EnrollmentConfig();
272 } 272 }
273 273
274 UserAffiliation BrowserPolicyConnectorChromeOS::GetUserAffiliation( 274 UserAffiliation BrowserPolicyConnectorChromeOS::GetUserAffiliation(
275 const std::string& user_name) { 275 const user_manager::UserID& user_id) {
276 // An empty username means incognito user in case of ChromiumOS and 276 // An empty username means incognito user in case of ChromiumOS and
277 // no logged-in user in case of Chromium (SigninService). Many tests use 277 // no logged-in user in case of Chromium (SigninService). Many tests use
278 // nonsense email addresses (e.g. 'test') so treat those as non-enterprise 278 // nonsense email addresses (e.g. 'test') so treat those as non-enterprise
279 // users. 279 // users.
280 if (user_name.empty() || user_name.find('@') == std::string::npos) 280 if (user_id.GetUserEmail().empty() || user_id.GetUserEmail().find('@') == std: :string::npos)
281 return USER_AFFILIATION_NONE; 281 return USER_AFFILIATION_NONE;
282 282
283 if (install_attributes_ && 283 if (install_attributes_ &&
284 (gaia::ExtractDomainName(gaia::CanonicalizeEmail(user_name)) == 284 (gaia::ExtractDomainName(gaia::CanonicalizeEmail(user_id.GetUserEmail())) ==
285 install_attributes_->GetDomain() || 285 install_attributes_->GetDomain() ||
286 policy::IsDeviceLocalAccountUser(user_name, NULL))) { 286 policy::IsDeviceLocalAccountUser(user_id, NULL))) {
287 return USER_AFFILIATION_MANAGED; 287 return USER_AFFILIATION_MANAGED;
288 } 288 }
289 289
290 return USER_AFFILIATION_NONE; 290 return USER_AFFILIATION_NONE;
291 } 291 }
292 292
293 void BrowserPolicyConnectorChromeOS::SetUserPolicyDelegate( 293 void BrowserPolicyConnectorChromeOS::SetUserPolicyDelegate(
294 ConfigurationPolicyProvider* user_policy_provider) { 294 ConfigurationPolicyProvider* user_policy_provider) {
295 global_user_cloud_policy_provider_->SetDelegate(user_policy_provider); 295 global_user_cloud_policy_provider_->SetDelegate(user_policy_provider);
296 } 296 }
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
371 consumer_device_management_service_.get(), 371 consumer_device_management_service_.get(),
372 GetBackgroundTaskRunner(), 372 GetBackgroundTaskRunner(),
373 install_attributes_.get(), 373 install_attributes_.get(),
374 state_keys_broker_.get(), 374 state_keys_broker_.get(),
375 device_cloud_policy_manager_->device_store(), 375 device_cloud_policy_manager_->device_store(),
376 device_cloud_policy_manager_)); 376 device_cloud_policy_manager_));
377 device_cloud_policy_initializer_->Init(); 377 device_cloud_policy_initializer_->Init();
378 } 378 }
379 379
380 } // namespace policy 380 } // namespace policy
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698