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/device_policy_cache.h" | 5 #include "chrome/browser/policy/device_policy_cache.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 // Decodes a protobuf integer to an IntegerValue. The caller assumes ownership | 97 // Decodes a protobuf integer to an IntegerValue. The caller assumes ownership |
98 // of the return Value*. Returns NULL in case the input value is out of bounds. | 98 // of the return Value*. Returns NULL in case the input value is out of bounds. |
99 Value* DecodeIntegerValue(google::protobuf::int64 value) { | 99 Value* DecodeIntegerValue(google::protobuf::int64 value) { |
100 if (value < std::numeric_limits<int>::min() || | 100 if (value < std::numeric_limits<int>::min() || |
101 value > std::numeric_limits<int>::max()) { | 101 value > std::numeric_limits<int>::max()) { |
102 LOG(WARNING) << "Integer value " << value | 102 LOG(WARNING) << "Integer value " << value |
103 << " out of numeric limits, ignoring."; | 103 << " out of numeric limits, ignoring."; |
104 return NULL; | 104 return NULL; |
105 } | 105 } |
106 | 106 |
107 return Value::CreateIntegerValue(static_cast<int>(value)); | 107 return base::NumberValue::New(static_cast<int>(value)); |
108 } | 108 } |
109 | 109 |
110 } // namespace | 110 } // namespace |
111 | 111 |
112 namespace policy { | 112 namespace policy { |
113 | 113 |
114 DevicePolicyCache::DevicePolicyCache( | 114 DevicePolicyCache::DevicePolicyCache( |
115 CloudPolicyDataStore* data_store, | 115 CloudPolicyDataStore* data_store, |
116 EnterpriseInstallAttributes* install_attributes) | 116 EnterpriseInstallAttributes* install_attributes) |
117 : data_store_(data_store), | 117 : data_store_(data_store), |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
318 DecodeIntegerValue( | 318 DecodeIntegerValue( |
319 container.device_policy_refresh_rate())); | 319 container.device_policy_refresh_rate())); |
320 } | 320 } |
321 } | 321 } |
322 | 322 |
323 if (policy.has_device_proxy_settings()) { | 323 if (policy.has_device_proxy_settings()) { |
324 const em::DeviceProxySettingsProto container = | 324 const em::DeviceProxySettingsProto container = |
325 policy.device_proxy_settings(); | 325 policy.device_proxy_settings(); |
326 if (container.has_proxy_mode()) { | 326 if (container.has_proxy_mode()) { |
327 recommended->Set(kPolicyProxyMode, | 327 recommended->Set(kPolicyProxyMode, |
328 Value::CreateStringValue(container.proxy_mode())); | 328 base::StringValue::New(container.proxy_mode())); |
329 } | 329 } |
330 if (container.has_proxy_server()) { | 330 if (container.has_proxy_server()) { |
331 recommended->Set(kPolicyProxyServer, | 331 recommended->Set(kPolicyProxyServer, |
332 Value::CreateStringValue(container.proxy_server())); | 332 base::StringValue::New(container.proxy_server())); |
333 } | 333 } |
334 if (container.has_proxy_pac_url()) { | 334 if (container.has_proxy_pac_url()) { |
335 recommended->Set(kPolicyProxyPacUrl, | 335 recommended->Set(kPolicyProxyPacUrl, |
336 Value::CreateStringValue(container.proxy_pac_url())); | 336 base::StringValue::New(container.proxy_pac_url())); |
337 } | 337 } |
338 if (container.has_proxy_bypass_list()) { | 338 if (container.has_proxy_bypass_list()) { |
339 recommended->Set(kPolicyProxyBypassList, | 339 recommended->Set(kPolicyProxyBypassList, |
340 Value::CreateStringValue(container.proxy_bypass_list())); | 340 base::StringValue::New(container.proxy_bypass_list())); |
341 } | 341 } |
342 } | 342 } |
343 | 343 |
344 if (policy.has_release_channel() && | 344 if (policy.has_release_channel() && |
345 policy.release_channel().has_release_channel()) { | 345 policy.release_channel().has_release_channel()) { |
346 std::string channel = policy.release_channel().release_channel(); | 346 std::string channel = policy.release_channel().release_channel(); |
347 mandatory->Set( | 347 mandatory->Set( |
348 kPolicyChromeOsReleaseChannel, Value::CreateStringValue(channel)); | 348 kPolicyChromeOsReleaseChannel, base::StringValue::New(channel)); |
349 // TODO(dubroy): Once http://crosbug.com/17015 is implemented, we won't | 349 // TODO(dubroy): Once http://crosbug.com/17015 is implemented, we won't |
350 // have to pass the channel in here, only ping the update engine to tell | 350 // have to pass the channel in here, only ping the update engine to tell |
351 // it to fetch the channel from the policy. | 351 // it to fetch the channel from the policy. |
352 chromeos::CrosLibrary::Get()->GetUpdateLibrary()->SetReleaseTrack(channel); | 352 chromeos::CrosLibrary::Get()->GetUpdateLibrary()->SetReleaseTrack(channel); |
353 } | 353 } |
354 } | 354 } |
355 | 355 |
356 } // namespace policy | 356 } // namespace policy |
OLD | NEW |