diff options
author | dubroy@chromium.org <dubroy@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-07-01 09:17:18 +0000 |
---|---|---|
committer | dubroy@chromium.org <dubroy@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-07-01 09:17:18 +0000 |
commit | 8c72f5d59854c9f29dd5cb9d801951dc61e8a2fb (patch) | |
tree | b4021cb3f5b12dd0e3a99e83725da9e2cc05655f | |
parent | 79b01b18dadc7541ff326de24a2f6be5a39b239d (diff) | |
download | chromium_src-8c72f5d59854c9f29dd5cb9d801951dc61e8a2fb.zip chromium_src-8c72f5d59854c9f29dd5cb9d801951dc61e8a2fb.tar.gz chromium_src-8c72f5d59854c9f29dd5cb9d801951dc61e8a2fb.tar.bz2 |
Add a device policy for specifying the release channel.
This is a first step towards a full solution. For now, if the release channel
is specified in a policy, it has the same effect as if the user changed the
combo box on the About page. Still to-do: store policy value into a LocalState
pref, UI changes, and make the setting secure (it's currently stored in
/etc/lsb-release).
BUG=chromium-os:15382
TEST=Run a local device_management test server and specify the release
channel in the device policy. Edit /etc/init/update-engine.conf to start
update_engine with the --v=0 option and restart update-engine. Enroll the
device and verify in /var/log/update-engine.conf that the track change was
noticed by the update engine.
Review URL: http://codereview.chromium.org/7287001
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@91280 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/app/policy/policy_templates.json | 30 | ||||
-rw-r--r-- | chrome/browser/chromeos/cros_settings_names.cc | 2 | ||||
-rw-r--r-- | chrome/browser/chromeos/cros_settings_names.h | 2 | ||||
-rw-r--r-- | chrome/browser/chromeos/login/signed_settings.cc | 6 | ||||
-rw-r--r-- | chrome/browser/chromeos/user_cros_settings_provider.cc | 3 | ||||
-rw-r--r-- | chrome/browser/policy/configuration_policy_pref_store.cc | 2 | ||||
-rw-r--r-- | chrome/browser/policy/device_policy_cache.cc | 12 | ||||
-rw-r--r-- | chrome/browser/policy/proto/chrome_device_policy.proto | 6 |
8 files changed, 61 insertions, 2 deletions
diff --git a/chrome/app/policy/policy_templates.json b/chrome/app/policy/policy_templates.json index 602669a..5c7f7a1 100644 --- a/chrome/app/policy/policy_templates.json +++ b/chrome/app/policy/policy_templates.json @@ -94,7 +94,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: 90 +# For your editing convenience: highest ID currently used: 91 # # Placeholders: # The following placeholder strings are automatically substituted: @@ -1565,6 +1565,34 @@ Setting this policy overrides the default value of 3 hours. Valid values for this policy are in the range from 1800000 (30 minutes) to 86400000 (1 day). Any values not in this range will be clamped to the respective boundary.''', }, + { + 'name': 'ChromeOsReleaseChannel', + 'type': 'string-enum', + 'items': [ + { + 'name': 'Stable', + 'value': 'stable-channel', + 'caption': '''Stable channel''' + }, + { + 'name': 'Beta', + 'value': 'beta-channel', + 'caption': '''Beta channel''' + }, + { + 'name': 'Dev - Unstable', + 'value': 'dev-channel', + 'caption': '''Dev channel (may be unstable)''' + } + ], + 'supported_on': ['chrome_os:1.0-'], + 'device_only': True, + 'features': {'dynamic_refresh': 1}, + 'example_value': 'stable-channel', + 'id': 91, + 'caption': '''Release channel''', + 'desc': '''Specifies the release channel that this device should be locked to. This policy is a work in progress; currently, the user can still change the release channel even if it's specified by the policy.''' + }, ], 'messages': { diff --git a/chrome/browser/chromeos/cros_settings_names.cc b/chrome/browser/chromeos/cros_settings_names.cc index ea9aa69..47544578 100644 --- a/chrome/browser/chromeos/cros_settings_names.cc +++ b/chrome/browser/chromeos/cros_settings_names.cc @@ -27,4 +27,6 @@ const char kDeviceOwner[] = "cros.device.owner"; const char kStatsReportingPref[] = "cros.metrics.reportingEnabled"; +const char kReleaseChannel[] = "cros.system.releaseChannel"; + } // namespace chromeos diff --git a/chrome/browser/chromeos/cros_settings_names.h b/chrome/browser/chromeos/cros_settings_names.h index 75f4fa9..5206875 100644 --- a/chrome/browser/chromeos/cros_settings_names.h +++ b/chrome/browser/chromeos/cros_settings_names.h @@ -25,6 +25,8 @@ extern const char kDeviceOwner[]; extern const char kStatsReportingPref[]; +extern const char kReleaseChannel[]; + } // namespace chromeos #endif // CHROME_BROWSER_CHROMEOS_CROS_SETTINGS_NAMES_H_ diff --git a/chrome/browser/chromeos/login/signed_settings.cc b/chrome/browser/chromeos/login/signed_settings.cc index f08e81c..470573a 100644 --- a/chrome/browser/chromeos/login/signed_settings.cc +++ b/chrome/browser/chromeos/login/signed_settings.cc @@ -752,6 +752,12 @@ std::string RetrievePropertyOp::LookUpInPolicy(const std::string& prop) { return ""; // Default to invalid proxy config (will be ignored). return serialized; + } else if (prop == kReleaseChannel) { + if (!pol.has_release_channel() || + !pol.release_channel().has_release_channel()) + return ""; // Default: don't change the release channel + return pol.release_channel().release_channel(); + } return std::string(); } diff --git a/chrome/browser/chromeos/user_cros_settings_provider.cc b/chrome/browser/chromeos/user_cros_settings_provider.cc index d430338..df911fb 100644 --- a/chrome/browser/chromeos/user_cros_settings_provider.cc +++ b/chrome/browser/chromeos/user_cros_settings_provider.cc @@ -44,7 +44,8 @@ const char* kBooleanSettings[] = { }; const char* kStringSettings[] = { - kDeviceOwner + kDeviceOwner, + kReleaseChannel }; const char* kListSettings[] = { diff --git a/chrome/browser/policy/configuration_policy_pref_store.cc b/chrome/browser/policy/configuration_policy_pref_store.cc index ccba75b..3e62c8d 100644 --- a/chrome/browser/policy/configuration_policy_pref_store.cc +++ b/chrome/browser/policy/configuration_policy_pref_store.cc @@ -1069,6 +1069,8 @@ ConfigurationPolicyPrefStore::GetChromePolicyDefinitionList() { #if defined(OS_CHROMEOS) { kPolicyChromeOsLockOnIdleSuspend, Value::TYPE_BOOLEAN, key::kChromeOsLockOnIdleSuspend }, + { kPolicyChromeOsReleaseChannel, Value::TYPE_STRING, + key::kChromeOsReleaseChannel }, #endif }; diff --git a/chrome/browser/policy/device_policy_cache.cc b/chrome/browser/policy/device_policy_cache.cc index de68940..f972779 100644 --- a/chrome/browser/policy/device_policy_cache.cc +++ b/chrome/browser/policy/device_policy_cache.cc @@ -9,6 +9,8 @@ #include "base/logging.h" #include "base/task.h" #include "base/values.h" +#include "chrome/browser/chromeos/cros/cros_library.h" +#include "chrome/browser/chromeos/cros/update_library.h" #include "chrome/browser/chromeos/cros_settings_names.h" #include "chrome/browser/chromeos/login/ownership_service.h" #include "chrome/browser/chromeos/user_cros_settings_provider.h" @@ -302,6 +304,16 @@ void DevicePolicyCache::DecodeDevicePolicy( Value::CreateStringValue(container.proxy_bypass_list())); } } + + if (policy.has_release_channel() && + policy.release_channel().has_release_channel()) { + std::string channel = policy.release_channel().release_channel(); + mandatory->Set( + kPolicyChromeOsReleaseChannel, Value::CreateStringValue(channel)); + // TODO: We should probably set the release track somewhere else, but this + // policy is a work-in-progress (http://crosbug.com/15382). + chromeos::CrosLibrary::Get()->GetUpdateLibrary()->SetReleaseTrack(channel); + } } } // namespace policy diff --git a/chrome/browser/policy/proto/chrome_device_policy.proto b/chrome/browser/policy/proto/chrome_device_policy.proto index b3f2aa2..f2e58e0 100644 --- a/chrome/browser/policy/proto/chrome_device_policy.proto +++ b/chrome/browser/policy/proto/chrome_device_policy.proto @@ -75,6 +75,11 @@ message MetricsEnabledProto { optional bool metrics_enabled = 1; } +message ReleaseChannelProto { + // One of "stable-channel", "beta-channel", or "dev-channel" + optional string release_channel = 1; +} + message ChromeDeviceSettingsProto { optional DevicePolicyRefreshRateProto device_policy_refresh_rate = 1; optional UserWhitelistProto user_whitelist = 2; @@ -85,4 +90,5 @@ message ChromeDeviceSettingsProto { optional DataRoamingEnabledProto data_roaming_enabled = 7; optional AllowNewUsersProto allow_new_users = 8; optional MetricsEnabledProto metrics_enabled = 9; + optional ReleaseChannelProto release_channel = 10; } |