| 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 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 } | 175 } |
| 176 | 176 |
| 177 void DeviceManagementPolicyProvider::SendPolicyRequest() { | 177 void DeviceManagementPolicyProvider::SendPolicyRequest() { |
| 178 if (!policy_request_pending_) { | 178 if (!policy_request_pending_) { |
| 179 policy_request_pending_ = true; | 179 policy_request_pending_ = true; |
| 180 em::DevicePolicyRequest policy_request; | 180 em::DevicePolicyRequest policy_request; |
| 181 policy_request.set_policy_scope(kChromePolicyScope); | 181 policy_request.set_policy_scope(kChromePolicyScope); |
| 182 em::DevicePolicySettingRequest* setting = | 182 em::DevicePolicySettingRequest* setting = |
| 183 policy_request.add_setting_request(); | 183 policy_request.add_setting_request(); |
| 184 setting->set_key(kChromeDevicePolicySettingKey); | 184 setting->set_key(kChromeDevicePolicySettingKey); |
| 185 setting->set_watermark(""); |
| 185 backend_->ProcessPolicyRequest(token_fetcher_->GetDeviceToken(), | 186 backend_->ProcessPolicyRequest(token_fetcher_->GetDeviceToken(), |
| 186 token_fetcher_->GetDeviceID(), | 187 token_fetcher_->GetDeviceID(), |
| 187 policy_request, this); | 188 policy_request, this); |
| 188 } | 189 } |
| 189 } | 190 } |
| 190 | 191 |
| 191 void DeviceManagementPolicyProvider::RefreshTaskExecute() { | 192 void DeviceManagementPolicyProvider::RefreshTaskExecute() { |
| 192 DCHECK(refresh_task_pending_); | 193 DCHECK(refresh_task_pending_); |
| 193 refresh_task_pending_ = false; | 194 refresh_task_pending_ = false; |
| 194 // If there is no valid device token, the token_fetcher_ apparently failed, | 195 // If there is no valid device token, the token_fetcher_ apparently failed, |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 237 const FilePath device_management_dir = user_data_dir.Append( | 238 const FilePath device_management_dir = user_data_dir.Append( |
| 238 FILE_PATH_LITERAL("Device Management")); | 239 FILE_PATH_LITERAL("Device Management")); |
| 239 if (!file_util::DirectoryExists(device_management_dir)) { | 240 if (!file_util::DirectoryExists(device_management_dir)) { |
| 240 if (!file_util::CreateDirectory(device_management_dir)) | 241 if (!file_util::CreateDirectory(device_management_dir)) |
| 241 NOTREACHED(); | 242 NOTREACHED(); |
| 242 } | 243 } |
| 243 return device_management_dir; | 244 return device_management_dir; |
| 244 } | 245 } |
| 245 | 246 |
| 246 } // namespace policy | 247 } // namespace policy |
| OLD | NEW |