| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "chrome/browser/policy/cloud_policy_subsystem.h" | 5 #include "chrome/browser/policy/cloud_policy_subsystem.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 cloud_policy_cache_->Load(); | 64 cloud_policy_cache_->Load(); |
| 65 | 65 |
| 66 device_token_fetcher_.reset( | 66 device_token_fetcher_.reset( |
| 67 new DeviceTokenFetcher(device_management_service_.get(), | 67 new DeviceTokenFetcher(device_management_service_.get(), |
| 68 cloud_policy_cache_.get(), | 68 cloud_policy_cache_.get(), |
| 69 notifier_.get())); | 69 notifier_.get())); |
| 70 } | 70 } |
| 71 } | 71 } |
| 72 | 72 |
| 73 CloudPolicySubsystem::~CloudPolicySubsystem() { | 73 CloudPolicySubsystem::~CloudPolicySubsystem() { |
| 74 DCHECK(!prefs_); | |
| 75 cloud_policy_controller_.reset(); | 74 cloud_policy_controller_.reset(); |
| 76 device_token_fetcher_.reset(); | 75 device_token_fetcher_.reset(); |
| 77 cloud_policy_cache_.reset(); | 76 cloud_policy_cache_.reset(); |
| 78 device_management_service_.reset(); | 77 device_management_service_.reset(); |
| 79 net::NetworkChangeNotifier::RemoveIPAddressObserver(this); | 78 net::NetworkChangeNotifier::RemoveIPAddressObserver(this); |
| 80 } | 79 } |
| 81 | 80 |
| 82 void CloudPolicySubsystem::OnIPAddressChanged() { | 81 void CloudPolicySubsystem::OnIPAddressChanged() { |
| 83 if (state() == CloudPolicySubsystem::NETWORK_ERROR && | 82 if (state() == CloudPolicySubsystem::NETWORK_ERROR && |
| 84 cloud_policy_controller_.get()) { | 83 cloud_policy_controller_.get()) { |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 | 122 |
| 124 CloudPolicySubsystem::ErrorDetails CloudPolicySubsystem::error_details() { | 123 CloudPolicySubsystem::ErrorDetails CloudPolicySubsystem::error_details() { |
| 125 return notifier_->error_details(); | 124 return notifier_->error_details(); |
| 126 } | 125 } |
| 127 | 126 |
| 128 void CloudPolicySubsystem::StopAutoRetry() { | 127 void CloudPolicySubsystem::StopAutoRetry() { |
| 129 cloud_policy_controller_->StopAutoRetry(); | 128 cloud_policy_controller_->StopAutoRetry(); |
| 130 device_token_fetcher_->StopAutoRetry(); | 129 device_token_fetcher_->StopAutoRetry(); |
| 131 } | 130 } |
| 132 | 131 |
| 133 ConfigurationPolicyProvider* CloudPolicySubsystem::GetManagedPolicyProvider() { | |
| 134 if (cloud_policy_cache_.get()) | |
| 135 return cloud_policy_cache_->GetManagedPolicyProvider(); | |
| 136 | |
| 137 return NULL; | |
| 138 } | |
| 139 | |
| 140 ConfigurationPolicyProvider* | |
| 141 CloudPolicySubsystem::GetRecommendedPolicyProvider() { | |
| 142 if (cloud_policy_cache_.get()) | |
| 143 return cloud_policy_cache_->GetRecommendedPolicyProvider(); | |
| 144 | |
| 145 return NULL; | |
| 146 } | |
| 147 | |
| 148 // static | 132 // static |
| 149 void CloudPolicySubsystem::RegisterPrefs(PrefService* pref_service) { | 133 void CloudPolicySubsystem::RegisterPrefs(PrefService* pref_service) { |
| 150 pref_service->RegisterIntegerPref(prefs::kPolicyRefreshRate, | 134 pref_service->RegisterIntegerPref(prefs::kPolicyRefreshRate, |
| 151 kDefaultPolicyRefreshRateMs, | 135 kDefaultPolicyRefreshRateMs, |
| 152 PrefService::UNSYNCABLE_PREF); | 136 PrefService::UNSYNCABLE_PREF); |
| 153 } | 137 } |
| 154 | 138 |
| 155 void CloudPolicySubsystem::UpdatePolicyRefreshRate() { | 139 void CloudPolicySubsystem::UpdatePolicyRefreshRate() { |
| 156 if (cloud_policy_controller_.get()) { | 140 if (cloud_policy_controller_.get()) { |
| 157 // Clamp to sane values. | 141 // Clamp to sane values. |
| (...skipping 11 matching lines...) Expand all Loading... |
| 169 policy_refresh_rate_.GetPrefName() == | 153 policy_refresh_rate_.GetPrefName() == |
| 170 *(Details<std::string>(details).ptr()) && | 154 *(Details<std::string>(details).ptr()) && |
| 171 prefs_ == Source<PrefService>(source).ptr()) { | 155 prefs_ == Source<PrefService>(source).ptr()) { |
| 172 UpdatePolicyRefreshRate(); | 156 UpdatePolicyRefreshRate(); |
| 173 } else { | 157 } else { |
| 174 NOTREACHED(); | 158 NOTREACHED(); |
| 175 } | 159 } |
| 176 } | 160 } |
| 177 | 161 |
| 178 } // namespace policy | 162 } // namespace policy |
| OLD | NEW |