| 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/task.h" | 10 #include "base/task.h" |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 } | 133 } |
| 134 | 134 |
| 135 void DeviceManagementPolicyProvider::SendPolicyRequest() { | 135 void DeviceManagementPolicyProvider::SendPolicyRequest() { |
| 136 if (!policy_request_pending_) { | 136 if (!policy_request_pending_) { |
| 137 em::DevicePolicyRequest policy_request; | 137 em::DevicePolicyRequest policy_request; |
| 138 policy_request.set_policy_scope(kChromePolicyScope); | 138 policy_request.set_policy_scope(kChromePolicyScope); |
| 139 em::DevicePolicySettingRequest* setting = | 139 em::DevicePolicySettingRequest* setting = |
| 140 policy_request.add_setting_request(); | 140 policy_request.add_setting_request(); |
| 141 setting->set_key(kChromeDevicePolicySettingKey); | 141 setting->set_key(kChromeDevicePolicySettingKey); |
| 142 backend_->ProcessPolicyRequest(token_fetcher_->GetDeviceToken(), | 142 backend_->ProcessPolicyRequest(token_fetcher_->GetDeviceToken(), |
| 143 token_fetcher_->GetDeviceID(), |
| 143 policy_request, this); | 144 policy_request, this); |
| 144 policy_request_pending_ = true; | 145 policy_request_pending_ = true; |
| 145 } | 146 } |
| 146 } | 147 } |
| 147 | 148 |
| 148 bool DeviceManagementPolicyProvider::IsPolicyStale() const { | 149 bool DeviceManagementPolicyProvider::IsPolicyStale() const { |
| 149 base::Time now(base::Time::NowFromSystemTime()); | 150 base::Time now(base::Time::NowFromSystemTime()); |
| 150 base::Time last_policy_refresh_time = | 151 base::Time last_policy_refresh_time = |
| 151 cache_->last_policy_refresh_time(); | 152 cache_->last_policy_refresh_time(); |
| 152 base::Time policy_expiration_time = | 153 base::Time policy_expiration_time = |
| (...skipping 14 matching lines...) Expand all Loading... |
| 167 const FilePath device_management_dir = user_data_dir.Append( | 168 const FilePath device_management_dir = user_data_dir.Append( |
| 168 FILE_PATH_LITERAL("Device Management")); | 169 FILE_PATH_LITERAL("Device Management")); |
| 169 if (!file_util::DirectoryExists(device_management_dir)) { | 170 if (!file_util::DirectoryExists(device_management_dir)) { |
| 170 if (!file_util::CreateDirectory(device_management_dir)) | 171 if (!file_util::CreateDirectory(device_management_dir)) |
| 171 NOTREACHED(); | 172 NOTREACHED(); |
| 172 } | 173 } |
| 173 return device_management_dir; | 174 return device_management_dir; |
| 174 } | 175 } |
| 175 | 176 |
| 176 } // namespace policy | 177 } // namespace policy |
| OLD | NEW |