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 { |
| 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 // |
| 35 // |name|: The name of the pref. |
| 36 // |
| 37 // |value|: The new value of the pref. |
| 38 static void setBooleanPref(DOMString name, boolean value, optional OnPrefSet
Callback callback); |
| 39 |
| 40 // Sets a number settings value. |
| 41 // |
| 42 // |name|: The name of the pref. |
| 43 // |
| 44 // |value|: The new value of the pref. |
| 45 static void setNumericPref(DOMString name, double value, optional OnPrefSetC
allback callback); |
| 46 |
| 47 // Sets a string settings value. |
| 48 // |
| 49 // |name|: The name of the pref. |
| 50 // |
| 51 // |value|: The new value of the pref. |
| 52 static void setStringPref(DOMString name, DOMString value, optional OnPrefSe
tCallback callback); |
| 53 |
| 54 // Sets a URL settings value. |
| 55 // |
| 56 // |name|: The name of the pref. |
| 57 // |
| 58 // |value|: The new value of the pref. |
| 59 static void setURLPref(DOMString name, DOMString value, optional OnPrefSetCa
llback callback); |
| 60 |
| 61 // Gets an array of all the prefs. |
| 62 static void getAllPrefs(GetAllPrefsCallback callback); |
| 63 |
| 64 // Gets the value of a specific pref. |
| 65 static void getPref(DOMString name, GetPrefCallback callback); |
| 66 }; |
| 67 |
| 68 interface Events { |
| 69 // Fired when a set of prefs has changed. |
| 70 // |
| 71 // |callback|: Callback fired with a list of prefs that changed. |
| 72 static void onPrefsChanged(GetAllPrefsCallback callback); |
| 73 }; |
| 74 }; |
OLD | NEW |