OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 // Use the <code>chrome.settingsPrivate</code> API to get or set preferences | 5 // Use the <code>chrome.settingsPrivate</code> API to get or set preferences |
6 // from the settings UI. | 6 // from the settings UI. |
7 namespace settingsPrivate { | 7 namespace settingsPrivate { |
8 // Type of a pref. | |
9 enum PrefType { BOOLEAN, NUMBER, STRING, URL, LIST, DICTIONARY }; | 8 enum PrefType { BOOLEAN, NUMBER, STRING, URL, LIST, DICTIONARY }; |
10 | 9 |
11 // Source of a restricted pref, either by policy or other source. | 10 enum ControlledBy { |
12 enum PolicySource { | |
13 DEVICE_POLICY, | 11 DEVICE_POLICY, |
14 USER_POLICY, | 12 USER_POLICY, |
15 OWNER, | 13 OWNER, |
16 PRIMARY_USER, | 14 PRIMARY_USER, |
17 EXTENSION | 15 EXTENSION |
18 }; | 16 }; |
19 | 17 |
20 // Enforcement type of a restricted pref. | 18 enum Enforcement { ENFORCED, RECOMMENDED }; |
21 enum PolicyEnforcement { ENFORCED, RECOMMENDED }; | |
22 | 19 |
23 dictionary PrefObject { | 20 dictionary PrefObject { |
24 // The key for the pref. | 21 // The key for the pref. |
25 DOMString key; | 22 DOMString key; |
26 | 23 |
27 // The type of the pref (e.g., boolean, string, etc.). | 24 // The type of the pref (e.g., boolean, string, etc.). |
28 PrefType type; | 25 PrefType type; |
29 | 26 |
30 // The current value of the pref. | 27 // The current value of the pref. |
31 any value; | 28 any value; |
32 | 29 |
33 // The policy source of the pref; an undefined value means there is no | 30 // The policy source of the pref; an undefined value means there is no |
34 // policy. | 31 // policy. |
35 PolicySource? policySource; | 32 ControlledBy? controlledBy; |
36 | 33 |
37 // The owner name if policySource == OWNER. | 34 // The owner name if controlledBy == OWNER. |
38 // The primary user name if policySource == PRIMARY_USER. | 35 // The primary user name if controlledBy == PRIMARY_USER. |
39 // The extension name if policySource == EXTENSION. | 36 // The extension name if controlledBy == EXTENSION. |
40 DOMString? policySourceName; | 37 DOMString? controlledByName; |
41 | 38 |
42 // The policy enforcement of the pref; must be specified if policySource is | 39 // The policy enforcement of the pref; must be specified if controlledBy is |
43 // also present. | 40 // also present. |
44 PolicyEnforcement? policyEnforcement; | 41 Enforcement? enforcement; |
45 | 42 |
46 // The recommended value if policyEnforcement == RECOMMENDED. | 43 // The recommended value if enforcement == RECOMMENDED. |
47 any? recommendedValue; | 44 any? recommendedValue; |
48 | 45 |
49 // The extension ID if policySource == EXTENSION. | 46 // The extension ID if controlledBy == EXTENSION. |
50 DOMString? extensionId; | 47 DOMString? extensionId; |
51 | 48 |
52 // True if the pref is not controlled by a policy or user, but it can not be | 49 // Whether the controlling extension can be disabled if controlledBy == |
53 // modified (pref->IsUserModifiable() is false). Defaults to false. | 50 // EXTENSION. |
54 boolean? readOnly; | 51 boolean? extensionCanBeDisabled; |
55 }; | 52 }; |
56 | 53 |
57 callback OnPrefSetCallback = void (boolean success); | 54 callback OnPrefSetCallback = void (boolean success); |
58 callback GetAllPrefsCallback = void (PrefObject[] prefs); | 55 callback GetAllPrefsCallback = void (PrefObject[] prefs); |
59 callback GetPrefCallback = void (PrefObject pref); | 56 callback GetPrefCallback = void (PrefObject pref); |
60 callback GetDefaultZoomCallback = void (double zoom); | 57 callback GetDefaultZoomCallback = void (double zoom); |
61 callback SetDefaultZoomCallback = void (boolean success); | 58 callback SetDefaultZoomCallback = void (boolean success); |
62 | 59 |
63 interface Functions { | 60 interface Functions { |
64 // Sets a settings value. | 61 // Sets a settings value. |
(...skipping 20 matching lines...) Expand all Loading... |
85 double zoom, optional SetDefaultZoomCallback callback); | 82 double zoom, optional SetDefaultZoomCallback callback); |
86 }; | 83 }; |
87 | 84 |
88 interface Events { | 85 interface Events { |
89 // Fired when a set of prefs has changed. | 86 // Fired when a set of prefs has changed. |
90 // | 87 // |
91 // |prefs| The prefs that changed. | 88 // |prefs| The prefs that changed. |
92 static void onPrefsChanged(PrefObject[] prefs); | 89 static void onPrefsChanged(PrefObject[] prefs); |
93 }; | 90 }; |
94 }; | 91 }; |
OLD | NEW |