| 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" |
| 11 #include "base/task.h" | 11 #include "base/task.h" |
| 12 #include "chrome/browser/browser_thread.h" | 12 #include "chrome/browser/browser_thread.h" |
| 13 #include "chrome/browser/policy/device_management_backend.h" | 13 #include "chrome/browser/policy/device_management_backend.h" |
| 14 #include "chrome/browser/policy/device_management_policy_cache.h" | 14 #include "chrome/browser/policy/device_management_policy_cache.h" |
| 15 #include "chrome/browser/policy/proto/device_management_constants.h" |
| 15 #include "chrome/common/chrome_paths.h" | 16 #include "chrome/common/chrome_paths.h" |
| 16 #include "chrome/common/chrome_switches.h" | 17 #include "chrome/common/chrome_switches.h" |
| 17 #include "chrome/common/notification_service.h" | 18 #include "chrome/common/notification_service.h" |
| 18 #include "chrome/common/notification_type.h" | 19 #include "chrome/common/notification_type.h" |
| 19 | 20 |
| 20 namespace policy { | 21 namespace policy { |
| 21 | 22 |
| 22 const char kChromePolicyScope[] = "chromeos/device"; | |
| 23 const char kChromeDevicePolicySettingKey[] = "chrome-policy"; | |
| 24 const int64 kPolicyRefreshRateInMilliseconds = 3 * 60 * 60 * 1000; // 3 hours | 23 const int64 kPolicyRefreshRateInMilliseconds = 3 * 60 * 60 * 1000; // 3 hours |
| 25 const int64 kPolicyRefreshMaxEarlierInMilliseconds = 20 * 60 * 1000; // 20 mins | 24 const int64 kPolicyRefreshMaxEarlierInMilliseconds = 20 * 60 * 1000; // 20 mins |
| 26 // These are the base values for delays before retrying after an error. They | 25 // These are the base values for delays before retrying after an error. They |
| 27 // will be doubled each time they are used. | 26 // will be doubled each time they are used. |
| 28 const int64 kPolicyRefreshErrorDelayInMilliseconds = 3 * 1000; // 3 seconds | 27 const int64 kPolicyRefreshErrorDelayInMilliseconds = 3 * 1000; // 3 seconds |
| 29 const int64 kDeviceTokenRefreshErrorDelayInMilliseconds = 3 * 1000; | 28 const int64 kDeviceTokenRefreshErrorDelayInMilliseconds = 3 * 1000; |
| 30 | 29 |
| 31 // Ensures that the portion of the policy provider implementation that requires | 30 // Ensures that the portion of the policy provider implementation that requires |
| 32 // the IOThread is deferred until the IOThread is fully initialized. The policy | 31 // the IOThread is deferred until the IOThread is fully initialized. The policy |
| 33 // provider posts this task on the UI thread during its constructor, thereby | 32 // provider posts this task on the UI thread during its constructor, thereby |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 230 const FilePath device_management_dir = user_data_dir.Append( | 229 const FilePath device_management_dir = user_data_dir.Append( |
| 231 FILE_PATH_LITERAL("Device Management")); | 230 FILE_PATH_LITERAL("Device Management")); |
| 232 if (!file_util::DirectoryExists(device_management_dir)) { | 231 if (!file_util::DirectoryExists(device_management_dir)) { |
| 233 if (!file_util::CreateDirectory(device_management_dir)) | 232 if (!file_util::CreateDirectory(device_management_dir)) |
| 234 NOTREACHED(); | 233 NOTREACHED(); |
| 235 } | 234 } |
| 236 return device_management_dir; | 235 return device_management_dir; |
| 237 } | 236 } |
| 238 | 237 |
| 239 } // namespace policy | 238 } // namespace policy |
| OLD | NEW |