|
|
Chromium Code Reviews|
Created:
7 years, 10 months ago by bartfab (slow) Modified:
7 years, 10 months ago CC:
chromium-reviews Base URL:
svn://svn.chromium.org/chrome/trunk/src Visibility:
Public. |
DescriptionAdd policies to control Chrome OS power management
This CL adds policies that set the newly added prefs for configuring
Chrome OS power management.
BUG=161267
TEST=Manual
Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=181504
Patch Set 1 #
Total comments: 11
Patch Set 2 : Fixed typos in policy_test_cases.json #Patch Set 3 : Comments addressed. #Patch Set 4 : Fix copy&paste mistake. #
Total comments: 2
Patch Set 5 : Allow clamping of values. Add unit tests. #Patch Set 6 : Add missing include. #Patch Set 7 : Rebased. #
Messages
Total messages: 13 (0 generated)
Hi Mattias, Could you please review? Hi Daniel, Could you please quickly look over the descriptions in policy_templates.json to make sure that I understood all new prefs correctly?
Mostly good. https://codereview.chromium.org/12217068/diff/1/chrome/app/policy/policy_temp... File chrome/app/policy/policy_templates.json (right): https://codereview.chromium.org/12217068/diff/1/chrome/app/policy/policy_temp... chrome/app/policy/policy_templates.json:3940: 'caption': '''Screen lock delay when running on AC power''', How does this interact with ChromeOSLockOnIdleSuspend? https://codereview.chromium.org/12217068/diff/1/chrome/app/policy/policy_temp... chrome/app/policy/policy_templates.json:3967: When this policy is set, it specifies the length of time that the user must remain idle before <ph name="PRODUCT_OS_NAME">$2<ex>Google Chrome OS</ex></ph> takes the idle action, which can be configured separately. If there's this action abstraction, why is screen locking handled separately above? https://codereview.chromium.org/12217068/diff/1/chrome/browser/policy/configu... File chrome/browser/policy/configuration_policy_handler.cc (right): https://codereview.chromium.org/12217068/diff/1/chrome/browser/policy/configu... chrome/browser/policy/configuration_policy_handler.cc:296: pref_path_(pref_path) {} Should this also have a CheckPolicySettings that makes sure the integer is within [0, 100]?
https://chromiumcodereview.appspot.com/12217068/diff/1/chrome/app/policy/poli... File chrome/app/policy/policy_templates.json (right): https://chromiumcodereview.appspot.com/12217068/diff/1/chrome/app/policy/poli... chrome/app/policy/policy_templates.json:3940: 'caption': '''Screen lock delay when running on AC power''', On 2013/02/07 16:52:01, Mattias Nissler wrote: > How does this interact with ChromeOSLockOnIdleSuspend? This is a *second* method for locking the screen. Apparently, it has always existed but has been semi-broken. Daniel rediscovered it during his refactoring work and resurrected it. The benefit of this separate idle timeout is twofold: * It allows locking to occur much earlier than suspend. * It allows locking to happen without suspend, e.g. when playing audio. ChromeOSLockOnIdleSuspend determines whether the screen should lock on suspend. Without suspend, that lock would never kick in. https://chromiumcodereview.appspot.com/12217068/diff/1/chrome/app/policy/poli... chrome/app/policy/policy_templates.json:3967: When this policy is set, it specifies the length of time that the user must remain idle before <ph name="PRODUCT_OS_NAME">$2<ex>Google Chrome OS</ex></ph> takes the idle action, which can be configured separately. On 2013/02/07 16:52:01, Mattias Nissler wrote: > If there's this action abstraction, why is screen locking handled separately > above? As explained above, this allows one timeout to be configured for locking and then another for a customizable "idle action", whic could also involve locking but does not have to. https://chromiumcodereview.appspot.com/12217068/diff/1/chrome/browser/policy/... File chrome/browser/policy/configuration_policy_handler.cc (right): https://chromiumcodereview.appspot.com/12217068/diff/1/chrome/browser/policy/... chrome/browser/policy/configuration_policy_handler.cc:296: pref_path_(pref_path) {} On 2013/02/07 16:52:01, Mattias Nissler wrote: > Should this also have a CheckPolicySettings that makes sure the integer is > within [0, 100]? For the policy in question, the valid range actually is [100, β[. But there is not really a need to check it as the backend will clamp values to the range. If you feel strongly, I will add a check and will rename |IntPercentageToDoublePolicyHandler| from its generic name to a name referencing the specific policy it validates.
The descriptions look good! I haven't looked at the code yet (on a phone, so the review site is especially painful). The default actions are shutting down rather than suspending when the user isn't logged in. Not sure whether it's necessary to go into that level of detail. I'll take a closer look on Friday PST. On Feb 7, 2013 8:28 AM, <bartfab@chromium.org> wrote: > Reviewers: Mattias Nissler, Daniel Erat, > > Message: > Hi Mattias, > > Could you please review? > > Hi Daniel, > > Could you please quickly look over the descriptions in > policy_templates.json to > make sure that I understood all new prefs correctly? > > Description: > Add policies to control Chrome OS power management > > This CL adds policies that set the newly added prefs for configuring > Chrome OS power management. > > BUG=161267 > TEST=Manual > > > Please review this at https://codereview.chromium.**org/12217068/<https://codereview.chromium.org/1... > > SVN Base: svn://svn.chromium.org/chrome/**trunk/src<http://svn.chromium.org/chrome/trunk/src> > > Affected files: > M chrome/app/policy/policy_**templates.json > M chrome/browser/policy/**configuration_policy_handler.h > M chrome/browser/policy/**configuration_policy_handler.**cc > M chrome/browser/policy/**configuration_policy_handler_**list.cc > M chrome/test/data/policy/**policy_test_cases.json > > >
The descriptions look good! I haven't looked at the code yet (on a phone, so the review site is especially painful). The default actions are shutting down rather than suspending when the user isn't logged in. Not sure whether it's necessary to go into that level of detail. I'll take a closer look on Friday PST. On Feb 7, 2013 8:28 AM, <bartfab@chromium.org> wrote: Reviewers: Mattias Nissler, Daniel Erat, Message: Hi Mattias, Could you please review? Hi Daniel, Could you please quickly look over the descriptions in policy_templates.json to make sure that I understood all new prefs correctly? Description: Add policies to control Chrome OS power management This CL adds policies that set the newly added prefs for configuring Chrome OS power management. BUG=161267 TEST=Manual Please review this at https://codereview.chromium.**org/12217068/<https://codereview.chromium.org/1... SVN Base: svn://svn.chromium.org/chrome/**trunk/src<http://svn.chromium.org/chrome/trunk/src> Affected files: M chrome/app/policy/policy_**templates.json M chrome/browser/policy/**configuration_policy_handler.h M chrome/browser/policy/**configuration_policy_handler.**cc M chrome/browser/policy/**configuration_policy_handler_**list.cc M chrome/test/data/policy/**policy_test_cases.json
On 2013/02/08 01:05:51, Daniel Erat wrote: > The descriptions look good! I haven't looked at the code yet (on a phone, > so the review site is especially painful). > > The default actions are shutting down rather than suspending when the user > isn't logged in. Not sure whether it's necessary to go into that level of > detail. We are actually in a lucky position here: Since these are user policies, they can only ever apply when a user is logged in. As the policies are not active when nobody is logged in, there is no need to discuss Chrome's behavior at the login screen in the descriptions. > > I'll take a closer look on Friday PST. > On Feb 7, 2013 8:28 AM, <mailto:bartfab@chromium.org> wrote: > > Reviewers: Mattias Nissler, Daniel Erat, > > Message: > Hi Mattias, > > Could you please review? > > Hi Daniel, > > Could you please quickly look over the descriptions in > policy_templates.json to > make sure that I understood all new prefs correctly? > > Description: > Add policies to control Chrome OS power management > > This CL adds policies that set the newly added prefs for configuring > Chrome OS power management. > > BUG=161267 > TEST=Manual > > > Please review this at > https://codereview.chromium.**org/12217068/%3Chttps://codereview.chromium.org...> > > SVN Base: > svn://svn.chromium.org/chrome/**trunk/src<http://svn.chromium.org/chrome/trunk/src> > > Affected files: > M chrome/app/policy/policy_**templates.json > M chrome/browser/policy/**configuration_policy_handler.h > M chrome/browser/policy/**configuration_policy_handler.**cc > M chrome/browser/policy/**configuration_policy_handler_**list.cc > M chrome/test/data/policy/**policy_test_cases.json
LGTM - but please consider whether you want to elaborate on the descriptions. https://chromiumcodereview.appspot.com/12217068/diff/1/chrome/app/policy/poli... File chrome/app/policy/policy_templates.json (right): https://chromiumcodereview.appspot.com/12217068/diff/1/chrome/app/policy/poli... chrome/app/policy/policy_templates.json:3940: 'caption': '''Screen lock delay when running on AC power''', On 2013/02/07 17:25:53, bartfab wrote: > On 2013/02/07 16:52:01, Mattias Nissler wrote: > > How does this interact with ChromeOSLockOnIdleSuspend? > > This is a *second* method for locking the screen. Apparently, it has always > existed but has been semi-broken. Daniel rediscovered it during his refactoring > work and resurrected it. > > The benefit of this separate idle timeout is twofold: > * It allows locking to occur much earlier than suspend. > * It allows locking to happen without suspend, e.g. when playing audio. > > ChromeOSLockOnIdleSuspend determines whether the screen should lock on suspend. > Without suspend, that lock would never kick in. Ah, now I get it :) Might be worthwhile to point this out in the policy_templates.json descriptions as well. https://chromiumcodereview.appspot.com/12217068/diff/1/chrome/app/policy/poli... chrome/app/policy/policy_templates.json:3967: When this policy is set, it specifies the length of time that the user must remain idle before <ph name="PRODUCT_OS_NAME">$2<ex>Google Chrome OS</ex></ph> takes the idle action, which can be configured separately. On 2013/02/07 17:25:53, bartfab wrote: > On 2013/02/07 16:52:01, Mattias Nissler wrote: > > If there's this action abstraction, why is screen locking handled separately > > above? > > As explained above, this allows one timeout to be configured for locking and > then another for a customizable "idle action", whic could also involve locking > but does not have to. > Makes sense, thanks for the explanation. https://chromiumcodereview.appspot.com/12217068/diff/1/chrome/browser/policy/... File chrome/browser/policy/configuration_policy_handler.cc (right): https://chromiumcodereview.appspot.com/12217068/diff/1/chrome/browser/policy/... chrome/browser/policy/configuration_policy_handler.cc:296: pref_path_(pref_path) {} On 2013/02/07 17:25:53, bartfab wrote: > On 2013/02/07 16:52:01, Mattias Nissler wrote: > > Should this also have a CheckPolicySettings that makes sure the integer is > > within [0, 100]? > > For the policy in question, the valid range actually is [100, β[. But there is > not really a need to check it as the backend will clamp values to the range. If > you feel strongly, I will add a check and will rename > |IntPercentageToDoublePolicyHandler| from its generic name to a name referencing > the specific policy it validates. It'd be nice to be able to get feedback in about:policy if the value is out of range. Maybe you want to make a generic IntRangePolicyHandler base class that does the error flagging and clamping? And then have a subclass that takes care of the divide-by-100-convert-to-double business? Anyhow, that's a nice-to-have, fine to land without these tweaks.
https://chromiumcodereview.appspot.com/12217068/diff/1/chrome/app/policy/poli... File chrome/app/policy/policy_templates.json (right): https://chromiumcodereview.appspot.com/12217068/diff/1/chrome/app/policy/poli... chrome/app/policy/policy_templates.json:3940: 'caption': '''Screen lock delay when running on AC power''', On 2013/02/08 09:47:49, Mattias Nissler wrote: > On 2013/02/07 17:25:53, bartfab wrote: > > On 2013/02/07 16:52:01, Mattias Nissler wrote: > > > How does this interact with ChromeOSLockOnIdleSuspend? > > > > This is a *second* method for locking the screen. Apparently, it has always > > existed but has been semi-broken. Daniel rediscovered it during his > refactoring > > work and resurrected it. > > > > The benefit of this separate idle timeout is twofold: > > * It allows locking to occur much earlier than suspend. > > * It allows locking to happen without suspend, e.g. when playing audio. > > > > ChromeOSLockOnIdleSuspend determines whether the screen should lock on > suspend. > > Without suspend, that lock would never kick in. > > Ah, now I get it :) Might be worthwhile to point this out in the > policy_templates.json descriptions as well. But isn't this what this part of the description already states? "The recommended way to lock the screen on idle is to enable screen locking on suspend and have <ph ame="PRODUCT_OS_NAME">$2<ex>Google Chrome OS</ex></ph> suspend after the idle delay. This policy should only be used when screen locking should occur a significant amount of time sooner than suspend or when suspend on idle is not desired at all." https://chromiumcodereview.appspot.com/12217068/diff/1/chrome/browser/policy/... File chrome/browser/policy/configuration_policy_handler.cc (right): https://chromiumcodereview.appspot.com/12217068/diff/1/chrome/browser/policy/... chrome/browser/policy/configuration_policy_handler.cc:296: pref_path_(pref_path) {} On 2013/02/08 09:47:49, Mattias Nissler wrote: > On 2013/02/07 17:25:53, bartfab wrote: > > On 2013/02/07 16:52:01, Mattias Nissler wrote: > > > Should this also have a CheckPolicySettings that makes sure the integer is > > > within [0, 100]? > > > > For the policy in question, the valid range actually is [100, β[. But there is > > not really a need to check it as the backend will clamp values to the range. > If > > you feel strongly, I will add a check and will rename > > |IntPercentageToDoublePolicyHandler| from its generic name to a name > referencing > > the specific policy it validates. > > It'd be nice to be able to get feedback in about:policy if the value is out of > range. Maybe you want to make a generic IntRangePolicyHandler base class that > does the error flagging and clamping? And then have a subclass that takes care > of the divide-by-100-convert-to-double business? Anyhow, that's a nice-to-have, > fine to land without these tweaks. Done.
lgtm still https://codereview.chromium.org/12217068/diff/13002/chrome/browser/policy/con... File chrome/browser/policy/configuration_policy_handler.cc (right): https://codereview.chromium.org/12217068/diff/13002/chrome/browser/policy/con... chrome/browser/policy/configuration_policy_handler.cc:254: return false; Another option could be to just clamp here and continue. I think you can argue this, pick whatever you like best :)
https://chromiumcodereview.appspot.com/12217068/diff/13002/chrome/browser/pol... File chrome/browser/policy/configuration_policy_handler.cc (right): https://chromiumcodereview.appspot.com/12217068/diff/13002/chrome/browser/pol... chrome/browser/policy/configuration_policy_handler.cc:254: return false; On 2013/02/08 12:04:26, Mattias Nissler wrote: > Another option could be to just clamp here and continue. I think you can argue > this, pick whatever you like best :) Done.
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/bartfab@chromium.org/12217068/5003
Message was sent while issue was closed.
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/bartfab@chromium.org/12217068/5003
Message was sent while issue was closed.
Failed to apply patch for chrome/app/policy/policy_templates.json:
While running patch -p1 --forward --force --no-backup-if-mismatch;
patching file chrome/app/policy/policy_templates.json
Hunk #1 FAILED at 112.
Hunk #2 succeeded at 4226 with fuzz 2 (offset 352 lines).
1 out of 2 hunks FAILED -- saving rejects to file
chrome/app/policy/policy_templates.json.rej
Patch: chrome/app/policy/policy_templates.json
Index: chrome/app/policy/policy_templates.json
diff --git a/chrome/app/policy/policy_templates.json
b/chrome/app/policy/policy_templates.json
index
4c1fa136ffef71ead999715d8d8bd58970887d00..0b89f461075fc5265dba3ba375afa3504c4ff776
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: 171
+# For your editing convenience: highest ID currently used: 184
#
# Placeholders:
# The following placeholder strings are automatically substituted:
@@ -3874,6 +3874,338 @@
The policy value should be specified in milliseconds. Values are clamped
to a range of 30 seconds to 24 hours.''',
},
+ {
+ 'name': 'PowerManagement',
+ 'type': 'group',
+ 'caption': '''Power mangement''',
+ 'desc': '''Configure power manegement in <ph
name="PRODUCT_OS_NAME">$2<ex>Google Chrome OS</ex></ph>.
+
+ These policies let you configure how <ph
name="PRODUCT_OS_NAME">$2<ex>Google Chrome OS</ex></ph> behaves when the user
remains idle for some amount of time.''',
+ 'policies': [
+ {
+ 'name': 'ScreenDimDelayAC',
+ 'type': 'int',
+ 'schema': { 'type': 'integer' },
+ 'supported_on': ['chrome_os:26-'],
+ 'features': {
+ 'dynamic_refresh': True,
+ 'per_profile': False,
+ },
+ 'example_value': 420000,
+ 'id': 172,
+ 'caption': '''Screen dim delay when running on AC power''',
+ 'desc': '''Specifies the length of time without user input after
which the screen is dimmed when running on AC power.
+
+ When this policy is set to a value greater than zero, it specifies
the length of time that the user must remain idle before <ph
name="PRODUCT_OS_NAME">$2<ex>Google Chrome OS</ex></ph> dims the screen.
+
+ When this policy is set to zero, <ph
name="PRODUCT_OS_NAME">$2<ex>Google Chrome OS</ex></ph> does not dim the screen
when the user becomes idle.
+
+ When this policy is unset, a default length of time is used.
+
+ The policy value should be specified in milliseconds. Values are
clamped to be less than or equal the screen off delay (if set) and the idle
delay.''',
+ },
+ {
+ 'name': 'ScreenOffDelayAC',
+ 'type': 'int',
+ 'schema': { 'type': 'integer' },
+ 'supported_on': ['chrome_os:26-'],
+ 'features': {
+ 'dynamic_refresh': True,
+ 'per_profile': False,
+ },
+ 'example_value': 480000,
+ 'id': 173,
+ 'caption': '''Screen off delay when running on AC power''',
+ 'desc': '''Specifies the length of time without user input after
which the screen is turned off when running on AC power.
+
+ When this policy is set to a value greater than zero, it specifies
the length of time that the user must remain idle before <ph
name="PRODUCT_OS_NAME">$2<ex>Google Chrome OS</ex></ph> turns off the screen.
+
+ When this policy is set to zero, <ph
name="PRODUCT_OS_NAME">$2<ex>Google Chrome OS</ex></ph> does not turn off the
screen when the user becomes idle.
+
+ When this policy is unset, a default length of time is used.
+
+ The policy value should be specified in milliseconds. Values are
clamped to be less than or equal the idle delay.''',
+ },
+ {
+ 'name': 'ScreenLockDelayAC',
+ 'type': 'int',
+ 'schema': { 'type': 'integer' },
+ 'supported_on': ['chrome_os:26-'],
+ 'features': {
+ 'dynamic_refresh': True,
+ 'per_profile': False,
+ },
+ 'example_value': 600000,
+ 'id': 174,
+ 'caption': '''Screen lock delay when running on AC power''',
+ 'desc': '''Specifies the length of time without user input after
which the screen is locked when running on AC power.
+
+ When this policy is set to a value greater than zero, it specifies
the length of time that the user must remain idle before <ph
name="PRODUCT_OS_NAME">$2<ex>Google Chrome OS</ex></ph> locks the screen.
+
+ When this policy is set to zero, <ph
name="PRODUCT_OS_NAME">$2<ex>Google Chrome OS</ex></ph> does not lock the screen
when the user becomes idle.
+
+ When this policy is unset, a default length of time is used.
+
+ The recommended way to lock the screen on idle is to enable screen
locking on suspend and have <ph name="PRODUCT_OS_NAME">$2<ex>Google Chrome
OS</ex></ph> suspend after the idle delay. This policy should only be used when
screen locking should occur a significant amount of time sooner than suspend or
when suspend on idle is not desired at all.
+
+ The policy value should be specified in milliseconds. Values are
clamped to be less than the idle delay.''',
+ },
+ {
+ 'name': 'IdleDelayAC',
+ 'type': 'int',
+ 'schema': { 'type': 'integer' },
+ 'supported_on': ['chrome_os:26-'],
+ 'features': {
+ 'dynamic_refresh': True,
+ 'per_profile': False,
+ },
+ 'example_value': 1800000,
+ 'id': 175,
+ 'caption': '''Idle delay when running on AC power''',
+ 'desc': '''Specifies the length of time without user input after
which the idle action is taken when running on AC power.
+
+ When this policy is set, it specifies the length of time that the
user must remain idle before <ph name="PRODUCT_OS_NAME">$2<ex>Google Chrome
OS</ex></ph> takes the idle action, which can be configured separately.
+
+ When this policy is unset, a default length of time is used.
+
+ The policy value should be specified in milliseconds.''',
+ },
+ {
+ 'name': 'ScreenDimDelayBattery',
+ 'type': 'int',
+ 'schema': { 'type': 'integer' },
+ 'supported_on': ['chrome_os:26-'],
+ 'features': {
+ 'dynamic_refresh': True,
+ 'per_profile': False,
+ },
+ 'example_value': 300000,
+ 'id': 176,
+ 'caption': '''Screen dim delay when running on battery power''',
+ 'desc': '''Specifies the length of time without user input after
which the screen is dimmed when running on battery power.
+
+ When this policy is set to a value greater than zero, it specifies
the length of time that the user must remain idle before <ph
name="PRODUCT_OS_NAME">$2<ex>Google Chrome OS</ex></ph> dims the screen.
+
+ When this policy is set to zero, <ph
name="PRODUCT_OS_NAME">$2<ex>Google Chrome OS</ex></ph> does not dim the screen
when the user becomes idle.
+
+ When this policy is unset, a default length of time is used.
+
+ The policy value should be specified in milliseconds. Values are
clamped to be less than or equal the screen off delay (if set) and the idle
delay.''',
+ },
+ {
+ 'name': 'ScreenOffDelayBattery',
+ 'type': 'int',
+ 'schema': { 'type': 'integer' },
+ 'supported_on': ['chrome_os:26-'],
+ 'features': {
+ 'dynamic_refresh': True,
+ 'per_profile': False,
+ },
+ 'example_value': 360000,
+ 'id': 177,
+ 'caption': '''Screen off delay when running on battery power''',
+ 'desc': '''Specifies the length of time without user input after
which the screen is turned off when running on battery power.
+
+ When this policy is set to a value greater than zero, it specifies
the length of time that the user must remain idle before <ph
name="PRODUCT_OS_NAME">$2<ex>Google Chrome OS</ex></ph> turns off the screen.
+
+ When this policy is set to zero, <ph
name="PRODUCT_OS_NAME">$2<ex>Google Chrome OS</ex></ph> does not turn off the
screen when the user becomes idle.
+
+ When this policy is unset, a default length of time is used.
+
+ The policy value should be specified in milliseconds. Values are
clamped to be less than or equal the idle delay.''',
+ },
+ {
+ 'name': 'ScreenLockDelayBattery',
+ 'type': 'int',
+ 'schema': { 'type': 'integer' },
+ 'supported_on': ['chrome_os:26-'],
+ 'features': {
+ 'dynamic_refresh': True,
+ 'per_profile': False,
+ },
+ 'example_value': 600000,
+ 'id': 178,
+ 'caption': '''Screen lock delay when running on battery power''',
+ 'desc': '''Specifies the length of time without user input after
which the screen is locked when running on battery power.
+
+ When this policy is set to a value greater than zero, it specifies
the length of time that the user must remain idle before <ph
name="PRODUCT_OS_NAME">$2<ex>Google Chrome OS</ex></ph> locks the screen.
+
+ When this policy is set to zero, <ph
name="PRODUCT_OS_NAME">$2<ex>Google Chrome OS</ex></ph> does not lock the screen
when the user becomes idle.
+
+ When this policy is unset, a default length of time is used.
+
+ The recommended way to lock the screen on idle is to enable screen
locking on suspend and have <ph name="PRODUCT_OS_NAME">$2<ex>Google Chrome
OS</ex></ph> suspend after thβ¦
(message too large)
|
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
