OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 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. | |
4 | |
5 // Use the <code>chrome.settingsPrivate</code> API to get or set preferences | |
6 // from the settings UI. | |
7 namespace settingsPrivate { | |
8 // Type of a pref. | |
9 enum PrefType { BOOLEAN, NUMBER, STRING, URL }; | |
10 | |
11 // Source of a pref (device, user). | |
12 enum PrefSource { DEVICE, USER }; | |
13 | |
14 dictionary PrefObject { | |
Dan Beam
2015/03/23 21:54:14
will we ever be able to specialize this? e.g. Boo
Jeremy Klein
2015/03/23 22:19:19
I don't know too much about the IDL, but I think t
| |
15 // The key for the pref. | |
16 DOMString key; | |
17 | |
18 // The type of the pref (e.g., boolean, string, etc.). | |
19 PrefType type; | |
20 | |
21 // The current value of the pref. | |
22 any value; | |
23 | |
24 // The source of the pref (e.g., device, user). | |
25 PrefSource source; | |
26 }; | |
27 | |
28 callback OnPrefSetCallback = void (boolean success); | |
29 callback GetAllPrefsCallback = void (PrefObject[] prefs); | |
30 callback GetPrefCallback = void (PrefObject pref); | |
31 | |
32 interface Functions { | |
33 // Sets a boolean settings value. | |
34 // |name|: The name of the pref. | |
35 // |value|: The new value of the pref. | |
36 static void setBooleanPref(DOMString name, boolean value, | |
37 optional OnPrefSetCallback callback); | |
38 | |
39 // Sets a number settings value. | |
40 // |name|: The name of the pref. | |
41 // |value|: The new value of the pref. | |
42 static void setNumericPref(DOMString name, double value, | |
43 optional OnPrefSetCallback callback); | |
44 | |
45 // Sets a string settings value. | |
46 // |name|: The name of the pref. | |
47 // |value|: The new value of the pref. | |
48 static void setStringPref(DOMString name, DOMString value, | |
49 optional OnPrefSetCallback callback); | |
50 | |
51 // Sets a URL settings value. | |
52 // |name|: The name of the pref. | |
53 // |value|: The new value of the pref. | |
54 static void setURLPref(DOMString name, DOMString value, | |
55 optional OnPrefSetCallback callback); | |
56 | |
57 // Gets an array of all the prefs. | |
58 static void getAllPrefs(GetAllPrefsCallback callback); | |
59 | |
60 // Gets the value of a specific pref. | |
61 static void getPref(DOMString name, GetPrefCallback callback); | |
62 }; | |
63 | |
64 interface Events { | |
65 // Fired when a set of prefs has changed. | |
66 // | |
67 // |callback|: Callback fired with a list of prefs that changed. | |
68 static void onPrefsChanged(GetAllPrefsCallback callback); | |
69 }; | |
70 }; | |
OLD | NEW |