| 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_cache.h" | 5 #include "chrome/browser/policy/device_management_policy_cache.h" |
| 6 | 6 |
| 7 #include <limits> | 7 #include <limits> |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 } | 63 } |
| 64 | 64 |
| 65 DeviceManagementPolicyCache::DeviceManagementPolicyCache( | 65 DeviceManagementPolicyCache::DeviceManagementPolicyCache( |
| 66 const FilePath& backing_file_path) | 66 const FilePath& backing_file_path) |
| 67 : backing_file_path_(backing_file_path), | 67 : backing_file_path_(backing_file_path), |
| 68 policy_(new DictionaryValue), | 68 policy_(new DictionaryValue), |
| 69 fresh_policy_(false), | 69 fresh_policy_(false), |
| 70 is_device_unmanaged_(false) { | 70 is_device_unmanaged_(false) { |
| 71 } | 71 } |
| 72 | 72 |
| 73 DeviceManagementPolicyCache::~DeviceManagementPolicyCache() {} |
| 74 |
| 73 void DeviceManagementPolicyCache::LoadPolicyFromFile() { | 75 void DeviceManagementPolicyCache::LoadPolicyFromFile() { |
| 74 if (!file_util::PathExists(backing_file_path_) || fresh_policy_) | 76 if (!file_util::PathExists(backing_file_path_) || fresh_policy_) |
| 75 return; | 77 return; |
| 76 | 78 |
| 77 // Read the protobuf from the file. | 79 // Read the protobuf from the file. |
| 78 std::string data; | 80 std::string data; |
| 79 if (!file_util::ReadFileToString(backing_file_path_, &data)) { | 81 if (!file_util::ReadFileToString(backing_file_path_, &data)) { |
| 80 LOG(WARNING) << "Failed to read policy data from " | 82 LOG(WARNING) << "Failed to read policy data from " |
| 81 << backing_file_path_.value(); | 83 << backing_file_path_.value(); |
| 82 return; | 84 return; |
| (...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 267 DeviceManagementPolicyCache::DecodeValue(named_value->value()); | 269 DeviceManagementPolicyCache::DecodeValue(named_value->value()); |
| 268 if (decoded_value) | 270 if (decoded_value) |
| 269 result->Set(named_value->name(), decoded_value); | 271 result->Set(named_value->name(), decoded_value); |
| 270 } | 272 } |
| 271 } | 273 } |
| 272 } | 274 } |
| 273 return result; | 275 return result; |
| 274 } | 276 } |
| 275 | 277 |
| 276 } // namespace policy | 278 } // namespace policy |
| OLD | NEW |