| OLD | NEW |
| 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 "components/policy/core/browser/browser_policy_connector.h" | 5 #include "components/policy/core/browser/browser_policy_connector.h" |
| 6 | 6 |
| 7 #include <stddef.h> |
| 8 |
| 7 #include <algorithm> | 9 #include <algorithm> |
| 8 #include <vector> | 10 #include <vector> |
| 9 | 11 |
| 10 #include "base/command_line.h" | 12 #include "base/command_line.h" |
| 11 #include "base/logging.h" | 13 #include "base/logging.h" |
| 14 #include "base/macros.h" |
| 12 #include "base/metrics/histogram_macros.h" | 15 #include "base/metrics/histogram_macros.h" |
| 13 #include "base/metrics/sparse_histogram.h" | 16 #include "base/metrics/sparse_histogram.h" |
| 14 #include "base/prefs/pref_registry_simple.h" | 17 #include "base/prefs/pref_registry_simple.h" |
| 15 #include "base/strings/string16.h" | 18 #include "base/strings/string16.h" |
| 16 #include "base/strings/utf_string_conversions.h" | 19 #include "base/strings/utf_string_conversions.h" |
| 17 #include "components/policy/core/common/cloud/cloud_policy_refresh_scheduler.h" | 20 #include "components/policy/core/common/cloud/cloud_policy_refresh_scheduler.h" |
| 18 #include "components/policy/core/common/cloud/device_management_service.h" | 21 #include "components/policy/core/common/cloud/device_management_service.h" |
| 19 #include "components/policy/core/common/configuration_policy_provider.h" | 22 #include "components/policy/core/common/configuration_policy_provider.h" |
| 20 #include "components/policy/core/common/policy_namespace.h" | 23 #include "components/policy/core/common/policy_namespace.h" |
| 21 #include "components/policy/core/common/policy_pref_names.h" | 24 #include "components/policy/core/common/policy_pref_names.h" |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 110 | 113 |
| 111 InitPolicyProviders(); | 114 InitPolicyProviders(); |
| 112 } | 115 } |
| 113 | 116 |
| 114 void BrowserPolicyConnector::Shutdown() { | 117 void BrowserPolicyConnector::Shutdown() { |
| 115 BrowserPolicyConnectorBase::Shutdown(); | 118 BrowserPolicyConnectorBase::Shutdown(); |
| 116 device_management_service_.reset(); | 119 device_management_service_.reset(); |
| 117 } | 120 } |
| 118 | 121 |
| 119 void BrowserPolicyConnector::ScheduleServiceInitialization( | 122 void BrowserPolicyConnector::ScheduleServiceInitialization( |
| 120 int64 delay_milliseconds) { | 123 int64_t delay_milliseconds) { |
| 121 // Skip device initialization if the BrowserPolicyConnector was never | 124 // Skip device initialization if the BrowserPolicyConnector was never |
| 122 // initialized (unit tests). | 125 // initialized (unit tests). |
| 123 if (device_management_service_) | 126 if (device_management_service_) |
| 124 device_management_service_->ScheduleInitialization(delay_milliseconds); | 127 device_management_service_->ScheduleInitialization(delay_milliseconds); |
| 125 } | 128 } |
| 126 | 129 |
| 127 // static | 130 // static |
| 128 bool BrowserPolicyConnector::IsNonEnterpriseUser(const std::string& username) { | 131 bool BrowserPolicyConnector::IsNonEnterpriseUser(const std::string& username) { |
| 129 if (username.empty() || username.find('@') == std::string::npos) { | 132 if (username.empty() || username.find('@') == std::string::npos) { |
| 130 // An empty username means incognito user in case of ChromiumOS and | 133 // An empty username means incognito user in case of ChromiumOS and |
| (...skipping 23 matching lines...) Expand all Loading... |
| 154 | 157 |
| 155 // static | 158 // static |
| 156 void BrowserPolicyConnector::RegisterPrefs(PrefRegistrySimple* registry) { | 159 void BrowserPolicyConnector::RegisterPrefs(PrefRegistrySimple* registry) { |
| 157 registry->RegisterIntegerPref( | 160 registry->RegisterIntegerPref( |
| 158 policy_prefs::kUserPolicyRefreshRate, | 161 policy_prefs::kUserPolicyRefreshRate, |
| 159 CloudPolicyRefreshScheduler::kDefaultRefreshDelayMs); | 162 CloudPolicyRefreshScheduler::kDefaultRefreshDelayMs); |
| 160 } | 163 } |
| 161 | 164 |
| 162 | 165 |
| 163 } // namespace policy | 166 } // namespace policy |
| OLD | NEW |