| 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> | 7 #include <stddef.h> |
| 8 #include <algorithm> | 8 #include <algorithm> |
| 9 #include <utility> | 9 #include <utility> |
| 10 #include <vector> | 10 #include <vector> |
| 11 | 11 |
| 12 #include "base/command_line.h" | 12 #include "base/command_line.h" |
| 13 #include "base/logging.h" | 13 #include "base/logging.h" |
| 14 #include "base/macros.h" | 14 #include "base/macros.h" |
| 15 #include "base/metrics/histogram_macros.h" | 15 #include "base/metrics/histogram_macros.h" |
| 16 #include "base/metrics/sparse_histogram.h" | 16 #include "base/metrics/sparse_histogram.h" |
| 17 #include "base/strings/string16.h" | 17 #include "base/strings/string16.h" |
| 18 #include "base/strings/utf_string_conversions.h" | 18 #include "base/strings/utf_string_conversions.h" |
| 19 #include "base/threading/thread_task_runner_handle.h" |
| 19 #include "components/policy/core/common/cloud/cloud_policy_refresh_scheduler.h" | 20 #include "components/policy/core/common/cloud/cloud_policy_refresh_scheduler.h" |
| 20 #include "components/policy/core/common/cloud/device_management_service.h" | 21 #include "components/policy/core/common/cloud/device_management_service.h" |
| 21 #include "components/policy/core/common/configuration_policy_provider.h" | 22 #include "components/policy/core/common/configuration_policy_provider.h" |
| 22 #include "components/policy/core/common/policy_namespace.h" | 23 #include "components/policy/core/common/policy_namespace.h" |
| 23 #include "components/policy/core/common/policy_pref_names.h" | 24 #include "components/policy/core/common/policy_pref_names.h" |
| 24 #include "components/policy/core/common/policy_statistics_collector.h" | 25 #include "components/policy/core/common/policy_statistics_collector.h" |
| 25 #include "components/policy/core/common/policy_switches.h" | 26 #include "components/policy/core/common/policy_switches.h" |
| 26 #include "components/prefs/pref_registry_simple.h" | 27 #include "components/prefs/pref_registry_simple.h" |
| 27 #include "google_apis/gaia/gaia_auth_util.h" | 28 #include "google_apis/gaia/gaia_auth_util.h" |
| 28 #include "policy/policy_constants.h" | 29 #include "policy/policy_constants.h" |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 | 100 |
| 100 void BrowserPolicyConnector::InitInternal( | 101 void BrowserPolicyConnector::InitInternal( |
| 101 PrefService* local_state, | 102 PrefService* local_state, |
| 102 std::unique_ptr<DeviceManagementService> device_management_service) { | 103 std::unique_ptr<DeviceManagementService> device_management_service) { |
| 103 DCHECK(!is_initialized()); | 104 DCHECK(!is_initialized()); |
| 104 | 105 |
| 105 device_management_service_ = std::move(device_management_service); | 106 device_management_service_ = std::move(device_management_service); |
| 106 | 107 |
| 107 policy_statistics_collector_.reset(new policy::PolicyStatisticsCollector( | 108 policy_statistics_collector_.reset(new policy::PolicyStatisticsCollector( |
| 108 base::Bind(&GetChromePolicyDetails), GetChromeSchema(), | 109 base::Bind(&GetChromePolicyDetails), GetChromeSchema(), |
| 109 GetPolicyService(), local_state, | 110 GetPolicyService(), local_state, base::ThreadTaskRunnerHandle::Get())); |
| 110 base::MessageLoop::current()->task_runner())); | |
| 111 policy_statistics_collector_->Initialize(); | 111 policy_statistics_collector_->Initialize(); |
| 112 | 112 |
| 113 InitPolicyProviders(); | 113 InitPolicyProviders(); |
| 114 } | 114 } |
| 115 | 115 |
| 116 void BrowserPolicyConnector::Shutdown() { | 116 void BrowserPolicyConnector::Shutdown() { |
| 117 BrowserPolicyConnectorBase::Shutdown(); | 117 BrowserPolicyConnectorBase::Shutdown(); |
| 118 device_management_service_.reset(); | 118 device_management_service_.reset(); |
| 119 } | 119 } |
| 120 | 120 |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 | 156 |
| 157 // static | 157 // static |
| 158 void BrowserPolicyConnector::RegisterPrefs(PrefRegistrySimple* registry) { | 158 void BrowserPolicyConnector::RegisterPrefs(PrefRegistrySimple* registry) { |
| 159 registry->RegisterIntegerPref( | 159 registry->RegisterIntegerPref( |
| 160 policy_prefs::kUserPolicyRefreshRate, | 160 policy_prefs::kUserPolicyRefreshRate, |
| 161 CloudPolicyRefreshScheduler::kDefaultRefreshDelayMs); | 161 CloudPolicyRefreshScheduler::kDefaultRefreshDelayMs); |
| 162 } | 162 } |
| 163 | 163 |
| 164 | 164 |
| 165 } // namespace policy | 165 } // namespace policy |
| OLD | NEW |