| Index: components/policy/core/browser/browser_policy_connector.cc
|
| diff --git a/components/policy/core/browser/browser_policy_connector.cc b/components/policy/core/browser/browser_policy_connector.cc
|
| index c4768783fc381282b55d9973f13c28b7813e283e..ac6ba892ff68d653984cd1eae092cac563c62ad4 100644
|
| --- a/components/policy/core/browser/browser_policy_connector.cc
|
| +++ b/components/policy/core/browser/browser_policy_connector.cc
|
| @@ -24,6 +24,7 @@
|
| #include "components/policy/core/common/policy_service_impl.h"
|
| #include "components/policy/core/common/policy_statistics_collector.h"
|
| #include "components/policy/core/common/policy_switches.h"
|
| +#include "components/user_manager/user_id.h"
|
| #include "google_apis/gaia/gaia_auth_util.h"
|
| #include "net/url_request/url_request_context_getter.h"
|
| #include "policy/policy_constants.h"
|
| @@ -214,16 +215,17 @@ void BrowserPolicyConnector::SetPolicyProviderForTesting(
|
| }
|
|
|
| // static
|
| -bool BrowserPolicyConnector::IsNonEnterpriseUser(const std::string& username) {
|
| - if (username.empty() || username.find('@') == std::string::npos) {
|
| - // An empty username means incognito user in case of ChromiumOS and
|
| +bool BrowserPolicyConnector::IsNonEnterpriseUser(const user_manager::UserID& user_id) {
|
| + const std::string& email = user_id.GetUserEmail();
|
| + if (email.empty() || email.find('@') == std::string::npos) {
|
| + // An empty email means incognito user in case of ChromiumOS and
|
| // no logged-in user in case of Chromium (SigninService). Many tests use
|
| // nonsense email addresses (e.g. 'test') so treat those as non-enterprise
|
| // users.
|
| return true;
|
| }
|
| const base::string16 domain = base::UTF8ToUTF16(
|
| - gaia::ExtractDomainName(gaia::CanonicalizeEmail(username)));
|
| + gaia::ExtractDomainName(gaia::CanonicalizeEmail(email)));
|
| for (size_t i = 0; i < arraysize(kNonManagedDomainPatterns); i++) {
|
| base::string16 pattern = base::WideToUTF16(kNonManagedDomainPatterns[i]);
|
| if (MatchDomain(domain, pattern, i))
|
|
|