OLD | NEW |
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 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_USERS_AFFILIATION_H_ | 5 #ifndef CHROME_BROWSER_CHROMEOS_LOGIN_USERS_AFFILIATION_H_ |
6 #define CHROME_BROWSER_CHROMEOS_LOGIN_USERS_AFFILIATION_H_ | 6 #define CHROME_BROWSER_CHROMEOS_LOGIN_USERS_AFFILIATION_H_ |
7 | 7 |
8 #include <set> | 8 #include <set> |
9 #include <string> | 9 #include <string> |
10 | 10 |
11 namespace chromeos { | 11 namespace chromeos { |
12 | 12 |
13 typedef std::set<std::string> AffiliationIDSet; | 13 typedef std::set<std::string> AffiliationIDSet; |
14 | 14 |
15 // Returns true if there is at least one common element in two sets. | 15 // Returns true if there is at least one common element in two sets. |
16 // Complexity: O(n + m), where n - size of the first set, m - size of | 16 // Complexity: O(n + m), where n - size of the first set, m - size of |
17 // the second set. | 17 // the second set. |
18 bool HaveCommonElement(const std::set<std::string>& set1, | 18 bool HaveCommonElement(const std::set<std::string>& set1, |
19 const std::set<std::string>& set2); | 19 const std::set<std::string>& set2); |
20 | 20 |
21 // TODO(peletskyi): Remove email and enterprise domain after affiliation | 21 // TODO(peletskyi): Remove email after affiliation based implementation will |
22 // based implementation will fully work. http://crbug.com/515476 | 22 // fully work. http://crbug.com/515476 |
23 // The function makes a decision if user with |user_affiliation_ids| and | 23 // The function makes a decision if user with |user_affiliation_ids| and |
24 // |email| is affiliated on the device with |device_affiliation_ids| and | 24 // |email| is affiliated on the device with |device_affiliation_ids| and |
25 // |enterprise_domain|. | 25 // |enterprise_domain|. |
26 bool IsUserAffiliated(const AffiliationIDSet& user_affiliation_ids, | 26 bool IsUserAffiliated(const AffiliationIDSet& user_affiliation_ids, |
27 const AffiliationIDSet& device_affiliation_ids, | 27 const AffiliationIDSet& device_affiliation_ids, |
28 const std::string& email, | 28 const std::string& email); |
29 const std::string& enterprise_domain); | |
30 | 29 |
31 } // namespace chromeos | 30 } // namespace chromeos |
32 | 31 |
33 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_USERS_AFFILIATION_H_ | 32 #endif // CHROME_BROWSER_CHROMEOS_LOGIN_USERS_AFFILIATION_H_ |
OLD | NEW |