-
Notifications
You must be signed in to change notification settings - Fork 6.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Shortcuts: Add ShortcutCustomizationAllowed policy
* This CL adds the ShortcutCustomizationAllowed admin policy. * Add |accelerator_prefs|, it will be get initialized by shell and used to register the boolean. * In the following CLs, we will use this policy to control ash::prefs::kShortcutCustomizationAllowed, then use the pref to allow/disallow customization of key shortcuts. We will also add an observer to support dynamic refresh (without needing to restart Chrome). * Follow this doc: - https://crsrc.org/c/docs/enterprise/add_new_policy.md Bug: b/216049298 Test: json tests Change-Id: Ifa2c541e774210f9625ec4cfa2951fea073a60aa Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4775980 Reviewed-by: Julian Pastarmov <pastarmovj@chromium.org> Reviewed-by: Roland Bock <rbock@google.com> Commit-Queue: Longbo Wei <longbowei@google.com> Reviewed-by: Jimmy Gong <jimmyxgong@chromium.org> Reviewed-by: Scott Violet <sky@chromium.org> Cr-Commit-Position: refs/heads/main@{#1187332}
- Loading branch information
Longbo Wei
authored and
Chromium LUCI CQ
committed
Aug 23, 2023
1 parent
f4c234d
commit dcc3837
Showing
12 changed files
with
132 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// Copyright 2023 The Chromium Authors | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
#include "ash/accelerators/accelerator_prefs.h" | ||
|
||
#include "ash/constants/ash_pref_names.h" | ||
#include "components/prefs/pref_registry_simple.h" | ||
|
||
namespace ash { | ||
|
||
AcceleratorPrefs::AcceleratorPrefs() = default; | ||
AcceleratorPrefs::~AcceleratorPrefs() = default; | ||
|
||
// static: | ||
void AcceleratorPrefs::RegisterProfilePrefs(PrefRegistrySimple* registry) { | ||
registry->RegisterBooleanPref(prefs::kShortcutCustomizationAllowed, true); | ||
} | ||
|
||
} // namespace ash |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
// Copyright 2023 The Chromium Authors | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
#ifndef ASH_ACCELERATORS_ACCELERATOR_PREFS_H_ | ||
#define ASH_ACCELERATORS_ACCELERATOR_PREFS_H_ | ||
|
||
#include "ash/ash_export.h" | ||
|
||
class PrefRegistrySimple; | ||
|
||
namespace ash { | ||
// `AcceleratorPrefs` manages shortcut preference settings. It is used to | ||
// register the prefs and observe the change in shortcut policy. | ||
class ASH_EXPORT AcceleratorPrefs { | ||
public: | ||
AcceleratorPrefs(); | ||
AcceleratorPrefs(const AcceleratorPrefs&) = delete; | ||
AcceleratorPrefs& operator=(const AcceleratorPrefs&) = delete; | ||
~AcceleratorPrefs(); | ||
|
||
static void RegisterProfilePrefs(PrefRegistrySimple* registry); | ||
}; | ||
|
||
} // namespace ash | ||
|
||
#endif // ASH_ACCELERATORS_ACCELERATOR_PREFS_H_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
...cy/resources/templates/policy_definitions/Miscellaneous/ShortcutCustomizationAllowed.yaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
caption: Allow customization of system shortcuts | ||
desc: |- | ||
This policy controls whether customization of system shortcuts is allowed. | ||
When this policy is enabled or unset, users will be able to customize system shortcuts through the Key Shortcuts App. | ||
When this policy is disabled, the Key Shortcuts app will be in read-only mode, disallowing any customization. | ||
default: true | ||
example_value: true | ||
features: | ||
dynamic_refresh: true | ||
per_profile: false | ||
owners: | ||
- jimmyxgong@chromium.org | ||
- zentaro@chromium.org | ||
- cros-peripheral@google.com | ||
items: | ||
- caption: Allow the user to customize system shortcuts | ||
value: true | ||
- caption: Disallow the user to customize system shortcuts | ||
value: false | ||
schema: | ||
type: boolean | ||
future_on: | ||
- chrome_os | ||
tags: [] | ||
type: main |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters