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

Side by Side Diff: chrome/browser/chromeos/login/users/affiliation.cc

Issue 2545523003: As YAPS server does not handle affiliation_ids correctly yet, we need to have a flag that would al… (Closed)
Patch Set: Added comments Created 4 years 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
« no previous file with comments | « no previous file | components/policy/core/common/policy_switches.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/login/users/affiliation.h" 5 #include "chrome/browser/chromeos/login/users/affiliation.h"
6 6
7 #include "base/command_line.h"
7 #include "chrome/browser/chromeos/policy/device_local_account.h" 8 #include "chrome/browser/chromeos/policy/device_local_account.h"
9 #include "components/policy/core/common/policy_switches.h"
8 #include "google_apis/gaia/gaia_auth_util.h" 10 #include "google_apis/gaia/gaia_auth_util.h"
9 11
10 namespace chromeos { 12 namespace chromeos {
11 13
12 bool HaveCommonElement(const std::set<std::string>& set1, 14 bool HaveCommonElement(const std::set<std::string>& set1,
13 const std::set<std::string>& set2) { 15 const std::set<std::string>& set2) {
14 std::set<std::string>::const_iterator it1 = set1.begin(); 16 std::set<std::string>::const_iterator it1 = set1.begin();
15 std::set<std::string>::const_iterator it2 = set2.begin(); 17 std::set<std::string>::const_iterator it2 = set2.begin();
16 18
17 while (it1 != set1.end() && it2 != set2.end()) { 19 while (it1 != set1.end() && it2 != set2.end()) {
(...skipping 15 matching lines...) Expand all
33 // logged-in user in case of Chrome (SigninService). Many tests use nonsense 35 // logged-in user in case of Chrome (SigninService). Many tests use nonsense
34 // email addresses (e.g. 'test') so treat those as non-enterprise users. 36 // email addresses (e.g. 'test') so treat those as non-enterprise users.
35 if (email.empty() || email.find('@') == std::string::npos) { 37 if (email.empty() || email.find('@') == std::string::npos) {
36 return false; 38 return false;
37 } 39 }
38 40
39 if (policy::IsDeviceLocalAccountUser(email, NULL)) { 41 if (policy::IsDeviceLocalAccountUser(email, NULL)) {
40 return true; 42 return true;
41 } 43 }
42 44
45 // Not all test servers correctly support affiliation ids so far, so
46 // this is a work-around.
47 // TODO(antrim): remove this once all test servers support affiliation ids.
48 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
49 if (command_line->HasSwitch(policy::switches::kUserAlwaysAffiliated)) {
50 return true;
51 }
52
43 if (!device_affiliation_ids.empty() && !user_affiliation_ids.empty()) { 53 if (!device_affiliation_ids.empty() && !user_affiliation_ids.empty()) {
44 return HaveCommonElement(user_affiliation_ids, device_affiliation_ids); 54 return HaveCommonElement(user_affiliation_ids, device_affiliation_ids);
45 } 55 }
46 56
47 return false; 57 return false;
48 } 58 }
49 59
50 } // namespace chromeos 60 } // namespace chromeos
OLDNEW
« no previous file with comments | « no previous file | components/policy/core/common/policy_switches.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698