OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/chromeos/policy/device_policy_decoder_chromeos.h" | 5 #include "chrome/browser/chromeos/policy/device_policy_decoder_chromeos.h" |
6 | 6 |
| 7 #include <stdint.h> |
| 8 |
7 #include <limits> | 9 #include <limits> |
8 #include <string> | 10 #include <string> |
9 | 11 |
10 #include "base/callback.h" | 12 #include "base/callback.h" |
11 #include "base/json/json_reader.h" | 13 #include "base/json/json_reader.h" |
12 #include "base/logging.h" | 14 #include "base/logging.h" |
| 15 #include "base/macros.h" |
13 #include "base/values.h" | 16 #include "base/values.h" |
14 #include "chrome/browser/browser_process.h" | 17 #include "chrome/browser/browser_process.h" |
15 #include "chrome/browser/chromeos/policy/device_local_account.h" | 18 #include "chrome/browser/chromeos/policy/device_local_account.h" |
16 #include "chrome/browser/chromeos/policy/proto/chrome_device_policy.pb.h" | 19 #include "chrome/browser/chromeos/policy/proto/chrome_device_policy.pb.h" |
17 #include "chromeos/dbus/dbus_thread_manager.h" | 20 #include "chromeos/dbus/dbus_thread_manager.h" |
18 #include "chromeos/dbus/update_engine_client.h" | 21 #include "chromeos/dbus/update_engine_client.h" |
19 #include "chromeos/settings/cros_settings_names.h" | 22 #include "chromeos/settings/cros_settings_names.h" |
20 #include "components/policy/core/browser/browser_policy_connector.h" | 23 #include "components/policy/core/browser/browser_policy_connector.h" |
21 #include "components/policy/core/common/external_data_fetcher.h" | 24 #include "components/policy/core/common/external_data_fetcher.h" |
22 #include "components/policy/core/common/policy_map.h" | 25 #include "components/policy/core/common/policy_map.h" |
23 #include "components/policy/core/common/policy_types.h" | 26 #include "components/policy/core/common/policy_types.h" |
24 #include "components/policy/core/common/schema.h" | 27 #include "components/policy/core/common/schema.h" |
25 #include "policy/policy_constants.h" | 28 #include "policy/policy_constants.h" |
26 #include "third_party/cros_system_api/dbus/service_constants.h" | 29 #include "third_party/cros_system_api/dbus/service_constants.h" |
27 | 30 |
28 using google::protobuf::RepeatedField; | 31 using google::protobuf::RepeatedField; |
29 using google::protobuf::RepeatedPtrField; | 32 using google::protobuf::RepeatedPtrField; |
30 | 33 |
31 namespace em = enterprise_management; | 34 namespace em = enterprise_management; |
32 | 35 |
33 namespace policy { | 36 namespace policy { |
34 | 37 |
35 namespace { | 38 namespace { |
36 | 39 |
37 // Decodes a protobuf integer to an IntegerValue. Returns NULL in case the input | 40 // Decodes a protobuf integer to an IntegerValue. Returns NULL in case the input |
38 // value is out of bounds. | 41 // value is out of bounds. |
39 scoped_ptr<base::Value> DecodeIntegerValue(google::protobuf::int64 value) { | 42 scoped_ptr<base::Value> DecodeIntegerValue(google::protobuf::int64_t value) { |
40 if (value < std::numeric_limits<int>::min() || | 43 if (value < std::numeric_limits<int>::min() || |
41 value > std::numeric_limits<int>::max()) { | 44 value > std::numeric_limits<int>::max()) { |
42 LOG(WARNING) << "Integer value " << value | 45 LOG(WARNING) << "Integer value " << value |
43 << " out of numeric limits, ignoring."; | 46 << " out of numeric limits, ignoring."; |
44 return scoped_ptr<base::Value>(); | 47 return scoped_ptr<base::Value>(); |
45 } | 48 } |
46 | 49 |
47 return scoped_ptr<base::Value>( | 50 return scoped_ptr<base::Value>( |
48 new base::FundamentalValue(static_cast<int>(value))); | 51 new base::FundamentalValue(static_cast<int>(value))); |
49 } | 52 } |
(...skipping 780 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
830 // Decode the various groups of policies. | 833 // Decode the various groups of policies. |
831 DecodeLoginPolicies(policy, policies); | 834 DecodeLoginPolicies(policy, policies); |
832 DecodeNetworkPolicies(policy, policies); | 835 DecodeNetworkPolicies(policy, policies); |
833 DecodeReportingPolicies(policy, policies); | 836 DecodeReportingPolicies(policy, policies); |
834 DecodeAutoUpdatePolicies(policy, policies); | 837 DecodeAutoUpdatePolicies(policy, policies); |
835 DecodeAccessibilityPolicies(policy, policies); | 838 DecodeAccessibilityPolicies(policy, policies); |
836 DecodeGenericPolicies(policy, policies); | 839 DecodeGenericPolicies(policy, policies); |
837 } | 840 } |
838 | 841 |
839 } // namespace policy | 842 } // namespace policy |
OLD | NEW |