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

Unified Diff: chrome/browser/policy/browser_policy_connector.cc

Issue 12088022: Enable cloud policy by default. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Review feedback Created 7 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/about_flags.cc ('k') | chrome/browser/policy/cloud_policy_browsertest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/policy/browser_policy_connector.cc
diff --git a/chrome/browser/policy/browser_policy_connector.cc b/chrome/browser/policy/browser_policy_connector.cc
index 5132383c0b51b850e18d45d0f18a3e3cd3ba109c..e81e9d932b899a75b36b165b4721f8043eeef965 100644
--- a/chrome/browser/policy/browser_policy_connector.cc
+++ b/chrome/browser/policy/browser_policy_connector.cc
@@ -221,7 +221,10 @@ DeviceMode BrowserPolicyConnector::GetDeviceMode() {
void BrowserPolicyConnector::ScheduleServiceInitialization(
int64 delay_milliseconds) {
- device_management_service_->ScheduleInitialization(delay_milliseconds);
+ // Skip device initialization if the BrowserPolicyConnector was never
+ // initialized (unit tests).
+ if (device_management_service_.get())
+ device_management_service_->ScheduleInitialization(delay_milliseconds);
}
#if defined(OS_CHROMEOS)
@@ -369,9 +372,11 @@ bool MatchDomain(const string16& domain, const string16& pattern) {
// static
bool BrowserPolicyConnector::IsNonEnterpriseUser(const std::string& username) {
- if (username.empty()) {
- // This means incognito user in case of ChromiumOS and
- // no logged-in user in case of Chromium (SigninService).
+ if (username.empty() || username.find('@') == std::string::npos) {
+ // An empty username 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;
}
« no previous file with comments | « chrome/browser/about_flags.cc ('k') | chrome/browser/policy/cloud_policy_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698