OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/user_policy_cache.h" | 5 #include "chrome/browser/policy/user_policy_cache.h" |
6 | 6 |
7 #include <limits> | 7 #include <limits> |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
11 #include "base/file_util.h" | 11 #include "base/file_util.h" |
12 #include "base/logging.h" | 12 #include "base/logging.h" |
13 #include "base/task.h" | 13 #include "base/task.h" |
14 #include "base/values.h" | 14 #include "base/values.h" |
| 15 #include "chrome/browser/browser_process.h" |
| 16 #include "chrome/browser/policy/browser_policy_connector.h" |
| 17 #include "chrome/browser/policy/cloud_policy_provider.h" |
15 #include "chrome/browser/policy/configuration_policy_pref_store.h" | 18 #include "chrome/browser/policy/configuration_policy_pref_store.h" |
16 #include "chrome/browser/policy/policy_map.h" | 19 #include "chrome/browser/policy/policy_map.h" |
17 #include "chrome/browser/policy/proto/cloud_policy.pb.h" | 20 #include "chrome/browser/policy/proto/cloud_policy.pb.h" |
18 #include "chrome/browser/policy/proto/device_management_local.pb.h" | 21 #include "chrome/browser/policy/proto/device_management_local.pb.h" |
19 #include "chrome/browser/policy/proto/old_generic_format.pb.h" | 22 #include "chrome/browser/policy/proto/old_generic_format.pb.h" |
20 #include "content/browser/browser_thread.h" | 23 #include "content/browser/browser_thread.h" |
21 #include "policy/configuration_policy_type.h" | 24 #include "policy/configuration_policy_type.h" |
22 | 25 |
23 namespace policy { | 26 namespace policy { |
24 | 27 |
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
257 ++named_value) { | 260 ++named_value) { |
258 if (named_value->has_value()) { | 261 if (named_value->has_value()) { |
259 Value* decoded_value = DecodeValue(named_value->value()); | 262 Value* decoded_value = DecodeValue(named_value->value()); |
260 if (decoded_value) | 263 if (decoded_value) |
261 result.Set(named_value->name(), decoded_value); | 264 result.Set(named_value->name(), decoded_value); |
262 } | 265 } |
263 } | 266 } |
264 // Hack: Let one of the providers do the transformation from DictionaryValue | 267 // Hack: Let one of the providers do the transformation from DictionaryValue |
265 // to PolicyMap, since they have the required code anyway. | 268 // to PolicyMap, since they have the required code anyway. |
266 PolicyMapProxy map_proxy(mandatory); | 269 PolicyMapProxy map_proxy(mandatory); |
267 GetManagedPolicyProvider()->ApplyPolicyValueTree(&result, &map_proxy); | 270 g_browser_process->browser_policy_connector()->GetManagedCloudProvider()-> |
| 271 ApplyPolicyValueTree(&result, &map_proxy); |
268 } | 272 } |
269 | 273 |
270 Value* UserPolicyCache::DecodeIntegerValue( | 274 Value* UserPolicyCache::DecodeIntegerValue( |
271 google::protobuf::int64 value) const { | 275 google::protobuf::int64 value) const { |
272 if (value < std::numeric_limits<int>::min() || | 276 if (value < std::numeric_limits<int>::min() || |
273 value > std::numeric_limits<int>::max()) { | 277 value > std::numeric_limits<int>::max()) { |
274 LOG(WARNING) << "Integer value " << value | 278 LOG(WARNING) << "Integer value " << value |
275 << " out of numeric limits, ignoring."; | 279 << " out of numeric limits, ignoring."; |
276 return NULL; | 280 return NULL; |
277 } | 281 } |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
341 return list; | 345 return list; |
342 } | 346 } |
343 default: | 347 default: |
344 NOTREACHED() << "Unhandled value type"; | 348 NOTREACHED() << "Unhandled value type"; |
345 } | 349 } |
346 | 350 |
347 return NULL; | 351 return NULL; |
348 } | 352 } |
349 | 353 |
350 } // namespace policy | 354 } // namespace policy |
OLD | NEW |