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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 | 124 |
126 CloudPolicySubsystem::ErrorDetails CloudPolicySubsystem::error_details() { | 125 CloudPolicySubsystem::ErrorDetails CloudPolicySubsystem::error_details() { |
127 return notifier_->error_details(); | 126 return notifier_->error_details(); |
128 } | 127 } |
129 | 128 |
130 void CloudPolicySubsystem::StopAutoRetry() { | 129 void CloudPolicySubsystem::StopAutoRetry() { |
131 cloud_policy_controller_->StopAutoRetry(); | 130 cloud_policy_controller_->StopAutoRetry(); |
132 device_token_fetcher_->StopAutoRetry(); | 131 device_token_fetcher_->StopAutoRetry(); |
133 } | 132 } |
134 | 133 |
135 ConfigurationPolicyProvider* CloudPolicySubsystem::GetManagedPolicyProvider() { | |
136 if (cloud_policy_cache_.get()) | |
137 return cloud_policy_cache_->GetManagedPolicyProvider(); | |
138 | |
139 return NULL; | |
140 } | |
141 | |
142 ConfigurationPolicyProvider* | |
143 CloudPolicySubsystem::GetRecommendedPolicyProvider() { | |
144 if (cloud_policy_cache_.get()) | |
145 return cloud_policy_cache_->GetRecommendedPolicyProvider(); | |
146 | |
147 return NULL; | |
148 } | |
149 | |
150 // static | 134 // static |
151 void CloudPolicySubsystem::RegisterPrefs(PrefService* pref_service) { | 135 void CloudPolicySubsystem::RegisterPrefs(PrefService* pref_service) { |
152 pref_service->RegisterIntegerPref(prefs::kPolicyRefreshRate, | 136 pref_service->RegisterIntegerPref(prefs::kPolicyRefreshRate, |
153 kDefaultPolicyRefreshRateMs, | 137 kDefaultPolicyRefreshRateMs, |
154 PrefService::UNSYNCABLE_PREF); | 138 PrefService::UNSYNCABLE_PREF); |
155 } | 139 } |
156 | 140 |
157 void CloudPolicySubsystem::UpdatePolicyRefreshRate() { | 141 void CloudPolicySubsystem::UpdatePolicyRefreshRate() { |
158 if (cloud_policy_controller_.get()) { | 142 if (cloud_policy_controller_.get()) { |
159 // Clamp to sane values. | 143 // Clamp to sane values. |
(...skipping 17 matching lines...) Expand all Loading... |
177 } | 161 } |
178 } | 162 } |
179 | 163 |
180 void CloudPolicySubsystem::ScheduleServiceInitialization( | 164 void CloudPolicySubsystem::ScheduleServiceInitialization( |
181 int64 delay_milliseconds) { | 165 int64 delay_milliseconds) { |
182 if (device_management_service_.get()) | 166 if (device_management_service_.get()) |
183 device_management_service_->ScheduleInitialization(delay_milliseconds); | 167 device_management_service_->ScheduleInitialization(delay_milliseconds); |
184 } | 168 } |
185 | 169 |
186 } // namespace policy | 170 } // namespace policy |
OLD | NEW |