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
3 // found in the LICENSE file.
5 // Use the <code>chrome.settingsPrivate</code> API to get or set preferences
6 // from the settings UI.
7 namespace settingsPrivate
{
9 enum PrefType
{ BOOLEAN, NUMBER
, STRING, URL
, LIST
};
11 // Policy source of a pref.
12 enum PolicySource
{ DEVICE
, USER
};
14 // Policy enforcement of a pref.
15 enum PolicyEnforcement
{ ENFORCED
, RECOMMENDED
};
17 dictionary PrefObject
{
18 // The key for the pref.
21 // The type of the pref (e.g., boolean, string, etc.).
24 // The current value of the pref.
27 // The policy source of the pref; an undefined value means there is no
29 PolicySource? policySource
;
31 // The policy enforcement of the pref; must be specified if policySource is
33 PolicyEnforcement? policyEnforcement
;
36 callback OnPrefSetCallback
= void (boolean success
);
37 callback GetAllPrefsCallback
= void (PrefObject
[] prefs
);
38 callback GetPrefCallback
= void (PrefObject pref
);
41 // Sets a settings value.
42 // |name|: The name of the pref.
43 // |value|: The new value of the pref.
44 // |pageId|: The user metrics identifier or null.
45 // |callback|: The callback for whether the pref was set or not.
46 static
void setPref
(DOMString name
, any value
,
47 DOMString pageId
, OnPrefSetCallback
callback);
49 // Gets an array of all the prefs.
50 static
void getAllPrefs
(GetAllPrefsCallback
callback);
52 // Gets the value of a specific pref.
53 static
void getPref
(DOMString name
, GetPrefCallback
callback);
57 // Fired when a set of prefs has changed.
59 // |prefs| The prefs that changed.
60 static
void onPrefsChanged
(PrefObject
[] prefs
);