OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/device_management_policy_provider.h" | 5 #include "chrome/browser/policy/device_management_policy_provider.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
10 #include "base/rand_util.h" | 10 #include "base/rand_util.h" |
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
105 } | 105 } |
106 | 106 |
107 void DeviceManagementPolicyProvider::OnError( | 107 void DeviceManagementPolicyProvider::OnError( |
108 DeviceManagementBackend::ErrorCode code) { | 108 DeviceManagementBackend::ErrorCode code) { |
109 policy_request_pending_ = false; | 109 policy_request_pending_ = false; |
110 if (code == DeviceManagementBackend::kErrorServiceDeviceNotFound || | 110 if (code == DeviceManagementBackend::kErrorServiceDeviceNotFound || |
111 code == DeviceManagementBackend::kErrorServiceManagementTokenInvalid) { | 111 code == DeviceManagementBackend::kErrorServiceManagementTokenInvalid) { |
112 LOG(WARNING) << "The device token was either invalid or unknown to the " | 112 LOG(WARNING) << "The device token was either invalid or unknown to the " |
113 << "device manager, re-registering device."; | 113 << "device manager, re-registering device."; |
114 token_fetcher_->Restart(); | 114 token_fetcher_->Restart(); |
| 115 } else if (code == |
| 116 DeviceManagementBackend::kErrorServiceManagementNotSupported) { |
| 117 VLOG(1) << "The device is no longer managed, resetting device token."; |
| 118 token_fetcher_->Restart(); |
115 } else { | 119 } else { |
116 LOG(WARNING) << "Could not provide policy from the device manager (error = " | 120 LOG(WARNING) << "Could not provide policy from the device manager (error = " |
117 << code << "), will retry in " | 121 << code << "), will retry in " |
118 << (policy_refresh_error_delay_ms_/1000) << " seconds."; | 122 << (policy_refresh_error_delay_ms_/1000) << " seconds."; |
119 ScheduleRefreshTask(policy_refresh_error_delay_ms_); | 123 ScheduleRefreshTask(policy_refresh_error_delay_ms_); |
120 policy_refresh_error_delay_ms_ *= 2; | 124 policy_refresh_error_delay_ms_ *= 2; |
121 if (policy_refresh_rate_ms_ && | 125 if (policy_refresh_rate_ms_ && |
122 policy_refresh_rate_ms_ < policy_refresh_error_delay_ms_) { | 126 policy_refresh_rate_ms_ < policy_refresh_error_delay_ms_) { |
123 policy_refresh_error_delay_ms_ = policy_refresh_rate_ms_; | 127 policy_refresh_error_delay_ms_ = policy_refresh_rate_ms_; |
124 } | 128 } |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
247 const FilePath device_management_dir = user_data_dir.Append( | 251 const FilePath device_management_dir = user_data_dir.Append( |
248 FILE_PATH_LITERAL("Device Management")); | 252 FILE_PATH_LITERAL("Device Management")); |
249 if (!file_util::DirectoryExists(device_management_dir)) { | 253 if (!file_util::DirectoryExists(device_management_dir)) { |
250 if (!file_util::CreateDirectory(device_management_dir)) | 254 if (!file_util::CreateDirectory(device_management_dir)) |
251 NOTREACHED(); | 255 NOTREACHED(); |
252 } | 256 } |
253 return device_management_dir; | 257 return device_management_dir; |
254 } | 258 } |
255 | 259 |
256 } // namespace policy | 260 } // namespace policy |
OLD | NEW |