summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/app/policy/policy_templates.json27
-rw-r--r--chrome/browser/policy/device_policy_cache.cc94
-rw-r--r--chrome/browser/policy/device_policy_cache.h3
-rw-r--r--chrome/browser/policy/proto/chrome_device_policy.proto18
-rwxr-xr-xchrome/test/functional/policy_test_cases.py2
5 files changed, 120 insertions, 24 deletions
diff --git a/chrome/app/policy/policy_templates.json b/chrome/app/policy/policy_templates.json
index 6fa181b..6fdd9ef 100644
--- a/chrome/app/policy/policy_templates.json
+++ b/chrome/app/policy/policy_templates.json
@@ -112,7 +112,7 @@
# persistent IDs for all fields (but not for groups!) are needed. These are
# specified by the 'id' keys of each policy. NEVER CHANGE EXISTING IDs,
# because doing so would break the deployed wire format!
-# For your editing convenience: highest ID currently used: 144
+# For your editing convenience: highest ID currently used: 146
#
# Placeholders:
# The following placeholder strings are automatically substituted:
@@ -2583,6 +2583,31 @@
'''
},
{
+ 'name': 'DeviceUpdateScatterFactor',
+ 'type': 'int',
+ 'supported_on': ['chrome_os:20-'],
+ 'device_only': True,
+ 'features': {'dynamic_refresh': True},
+ 'example_value': 7200,
+ 'id': 145,
+ 'caption': '''Auto update scatter factor''',
+ 'desc': '''Specifies the number of seconds up to which a device may randomly delay its download of an update from the time the update was first pushed out to the server. The device may wait a portion of this time in terms of wall-clock-time and the remaining portion in terms of the number of update checks. In any case, the scatter is upper bounded to a constant amount of time so that a device does not ever get stuck waiting to download an update forever.'''
+ },
+ {
+ 'name': 'DeviceUpdateAllowedConnectionTypes',
+ 'type': 'list',
+ 'supported_on': ['chrome_os:21-'],
+ 'device_only': True,
+ 'features': {'dynamic_refresh': True},
+ 'example_value': [ 'ethernet' ],
+ 'id': 146,
+ 'caption': '''Connection types allowed for updates''',
+ 'desc': ''' The types of connections that are OK to use for OS updates. OS updates potentially put heavy strain on the connection due to their size and may incur additional cost. Therefore, they are by default not enabled for connection types that are considered expensive, which include WiMax, Bluetooth and Cellular at the moment.
+
+ The recognized connection type identifiers are ethernet, wifi, wimax, bluetooth, cellular.
+ '''
+ },
+ {
'name': 'BackgroundModeEnabled',
'type': 'main',
'supported_on': ['chrome.win:19-', 'chrome.linux:19-'],
diff --git a/chrome/browser/policy/device_policy_cache.cc b/chrome/browser/policy/device_policy_cache.cc
index 3c4bb24..d1b666b 100644
--- a/chrome/browser/policy/device_policy_cache.cc
+++ b/chrome/browser/policy/device_policy_cache.cc
@@ -29,7 +29,9 @@
#include "chromeos/dbus/dbus_thread_manager.h"
#include "chromeos/dbus/update_engine_client.h"
#include "policy/policy_constants.h"
+#include "third_party/cros_system_api/dbus/service_constants.h"
+using google::protobuf::RepeatedField;
using google::protobuf::RepeatedPtrField;
namespace em = enterprise_management;
@@ -112,6 +114,21 @@ Value* DecodeIntegerValue(google::protobuf::int64 value) {
return Value::CreateIntegerValue(static_cast<int>(value));
}
+Value* DecodeConnectionType(int value) {
+ static const char* const kConnectionTypes[] = {
+ flimflam::kTypeEthernet,
+ flimflam::kTypeWifi,
+ flimflam::kTypeWimax,
+ flimflam::kTypeBluetooth,
+ flimflam::kTypeCellular,
+ };
+
+ if (value < 0 || value >= static_cast<int>(arraysize(kConnectionTypes)))
+ return NULL;
+
+ return Value::CreateStringValue(kConnectionTypes[value]);
+}
+
} // namespace
namespace policy {
@@ -356,6 +373,7 @@ void DevicePolicyCache::DecodeDevicePolicy(
DecodeKioskPolicies(policy, policies, install_attributes_);
DecodeNetworkPolicies(policy, policies, install_attributes_);
DecodeReportingPolicies(policy, policies);
+ DecodeAutoUpdatePolicies(policy, policies);
DecodeGenericPolicies(policy, policies);
}
@@ -589,30 +607,9 @@ void DevicePolicyCache::DecodeReportingPolicies(
}
// static
-void DevicePolicyCache::DecodeGenericPolicies(
+void DevicePolicyCache::DecodeAutoUpdatePolicies(
const em::ChromeDeviceSettingsProto& policy,
PolicyMap* policies) {
- if (policy.has_device_policy_refresh_rate()) {
- const em::DevicePolicyRefreshRateProto& container(
- policy.device_policy_refresh_rate());
- if (container.has_device_policy_refresh_rate()) {
- policies->Set(key::kDevicePolicyRefreshRate,
- POLICY_LEVEL_MANDATORY,
- POLICY_SCOPE_MACHINE,
- DecodeIntegerValue(container.device_policy_refresh_rate()));
- }
- }
-
- if (policy.has_metrics_enabled()) {
- const em::MetricsEnabledProto& container(policy.metrics_enabled());
- if (container.has_metrics_enabled()) {
- policies->Set(key::kDeviceMetricsReportingEnabled,
- POLICY_LEVEL_MANDATORY,
- POLICY_SCOPE_MACHINE,
- Value::CreateBooleanValue(container.metrics_enabled()));
- }
- }
-
if (policy.has_release_channel()) {
const em::ReleaseChannelProto& container(policy.release_channel());
if (container.has_release_channel()) {
@@ -652,6 +649,59 @@ void DevicePolicyCache::DecodeGenericPolicies(
Value::CreateStringValue(
container.target_version_prefix()));
}
+
+ // target_version_display_name is not actually a policy, but a display
+ // string for target_version_prefix, so we ignore it.
+
+ if (container.has_scatter_factor_in_seconds()) {
+ policies->Set(key::kDeviceUpdateScatterFactor,
+ POLICY_LEVEL_MANDATORY,
+ POLICY_SCOPE_MACHINE,
+ Value::CreateIntegerValue(
+ container.scatter_factor_in_seconds()));
+ }
+
+ if (container.allowed_connection_types_size()) {
+ ListValue* allowed_connection_types = new ListValue();
+ RepeatedField<int>::const_iterator entry;
+ for (entry = container.allowed_connection_types().begin();
+ entry != container.allowed_connection_types().end();
+ ++entry) {
+ base::Value* value = DecodeConnectionType(*entry);
+ if (value)
+ allowed_connection_types->Append(value);
+ }
+ policies->Set(key::kDeviceUpdateAllowedConnectionTypes,
+ POLICY_LEVEL_MANDATORY,
+ POLICY_SCOPE_MACHINE,
+ allowed_connection_types);
+ }
+ }
+}
+
+// static
+void DevicePolicyCache::DecodeGenericPolicies(
+ const em::ChromeDeviceSettingsProto& policy,
+ PolicyMap* policies) {
+ if (policy.has_device_policy_refresh_rate()) {
+ const em::DevicePolicyRefreshRateProto& container(
+ policy.device_policy_refresh_rate());
+ if (container.has_device_policy_refresh_rate()) {
+ policies->Set(key::kDevicePolicyRefreshRate,
+ POLICY_LEVEL_MANDATORY,
+ POLICY_SCOPE_MACHINE,
+ DecodeIntegerValue(container.device_policy_refresh_rate()));
+ }
+ }
+
+ if (policy.has_metrics_enabled()) {
+ const em::MetricsEnabledProto& container(policy.metrics_enabled());
+ if (container.has_metrics_enabled()) {
+ policies->Set(key::kDeviceMetricsReportingEnabled,
+ POLICY_LEVEL_MANDATORY,
+ POLICY_SCOPE_MACHINE,
+ Value::CreateBooleanValue(container.metrics_enabled()));
+ }
}
if (policy.has_start_up_urls()) {
diff --git a/chrome/browser/policy/device_policy_cache.h b/chrome/browser/policy/device_policy_cache.h
index c396a9f..0987296 100644
--- a/chrome/browser/policy/device_policy_cache.h
+++ b/chrome/browser/policy/device_policy_cache.h
@@ -98,6 +98,9 @@ class DevicePolicyCache : public CloudPolicyCacheBase {
static void DecodeReportingPolicies(
const enterprise_management::ChromeDeviceSettingsProto& policy,
PolicyMap* policies);
+ static void DecodeAutoUpdatePolicies(
+ const enterprise_management::ChromeDeviceSettingsProto& policy,
+ PolicyMap* policies);
static void DecodeGenericPolicies(
const enterprise_management::ChromeDeviceSettingsProto& policy,
PolicyMap* policies);
diff --git a/chrome/browser/policy/proto/chrome_device_policy.proto b/chrome/browser/policy/proto/chrome_device_policy.proto
index 17a1743c..5313c88 100644
--- a/chrome/browser/policy/proto/chrome_device_policy.proto
+++ b/chrome/browser/policy/proto/chrome_device_policy.proto
@@ -178,10 +178,26 @@ message AutoUpdateSettingsProto {
// delay its download of an update from the time the update was first pushed
// out to the server. The device may wait a portion of this time in terms
// of wall-clock-time and the remaining portion in terms of the number of
- // update checks. In any case, the scatter is upper bounded to a constant
+ // update checks. In any case, the scatter is upper bounded by a constant
// amount of time so that a device does not ever get stuck waiting to download
// an update forever.
optional int64 scatter_factor_in_seconds = 4;
+
+ // Enumerates network connection types.
+ enum ConnectionType {
+ CONNECTION_TYPE_ETHERNET = 0;
+ CONNECTION_TYPE_WIFI = 1;
+ CONNECTION_TYPE_WIMAX = 2;
+ CONNECTION_TYPE_BLUETOOTH = 3;
+ CONNECTION_TYPE_CELLULAR = 4;
+ }
+
+ // The types of connections that are OK to use for OS updates. OS updates
+ // potentially put heavy strain on the connection due to their size and may
+ // incur additional cost. Therefore, they are by default not enabled for
+ // connection types that are considered expensive, which include WiMax,
+ // Bluetooth and Cellular at the moment.
+ repeated ConnectionType allowed_connection_types = 5;
}
message StartUpUrlsProto {
diff --git a/chrome/test/functional/policy_test_cases.py b/chrome/test/functional/policy_test_cases.py
index 78bf2b9..1ed34e6 100755
--- a/chrome/test/functional/policy_test_cases.py
+++ b/chrome/test/functional/policy_test_cases.py
@@ -273,6 +273,8 @@ class PolicyPrefsTestCases(object):
'DeviceAppPack': (None, [], [], ['chromeos']),
'DeviceAutoUpdateDisabled': (None, True, [], ['chromeos']),
'DeviceTargetVersionPrefix': (None, '1412.', [], ['chromeos']),
+ 'DeviceUpdateScatterFactor': (None, '7200', [], ['chromeos']),
+ 'DeviceUpdateAllowedConnectionTypes': (None, [], [], ['chromeos']),
'ReportDeviceLocation': (None, False, [], ['chromeos']),
# Chrome Frame policies: