| 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. | 8 // Type of a pref. |
| 9 enum PrefType { BOOLEAN, NUMBER, STRING, URL, LIST, DICTIONARY }; | 9 enum PrefType { BOOLEAN, NUMBER, STRING, URL, LIST, DICTIONARY }; |
| 10 | 10 |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 DOMString? extensionId; | 50 DOMString? extensionId; |
| 51 | 51 |
| 52 // True if the pref is not controlled by a policy or user, but it can not be | 52 // True if the pref is not controlled by a policy or user, but it can not be |
| 53 // modified (pref->IsUserModifiable() is false). Defaults to false. | 53 // modified (pref->IsUserModifiable() is false). Defaults to false. |
| 54 boolean? readOnly; | 54 boolean? readOnly; |
| 55 }; | 55 }; |
| 56 | 56 |
| 57 callback OnPrefSetCallback = void (boolean success); | 57 callback OnPrefSetCallback = void (boolean success); |
| 58 callback GetAllPrefsCallback = void (PrefObject[] prefs); | 58 callback GetAllPrefsCallback = void (PrefObject[] prefs); |
| 59 callback GetPrefCallback = void (PrefObject pref); | 59 callback GetPrefCallback = void (PrefObject pref); |
| 60 callback GetDefaultZoomPercentCallback = void (double percent); | 60 callback GetDefaultZoomCallback = void (double zoom); |
| 61 callback SetDefaultZoomPercentCallback = void (boolean success); | 61 callback SetDefaultZoomCallback = void (boolean success); |
| 62 | 62 |
| 63 interface Functions { | 63 interface Functions { |
| 64 // Sets a settings value. | 64 // Sets a settings value. |
| 65 // |name|: The name of the pref. | 65 // |name|: The name of the pref. |
| 66 // |value|: The new value of the pref. | 66 // |value|: The new value of the pref. |
| 67 // |pageId|: The user metrics identifier or null. | 67 // |pageId|: The user metrics identifier or null. |
| 68 // |callback|: The callback for whether the pref was set or not. | 68 // |callback|: The callback for whether the pref was set or not. |
| 69 static void setPref(DOMString name, any value, | 69 static void setPref(DOMString name, any value, |
| 70 DOMString pageId, OnPrefSetCallback callback); | 70 DOMString pageId, OnPrefSetCallback callback); |
| 71 | 71 |
| 72 // Gets an array of all the prefs. | 72 // Gets an array of all the prefs. |
| 73 static void getAllPrefs(GetAllPrefsCallback callback); | 73 static void getAllPrefs(GetAllPrefsCallback callback); |
| 74 | 74 |
| 75 // Gets the value of a specific pref. | 75 // Gets the value of a specific pref. |
| 76 static void getPref(DOMString name, GetPrefCallback callback); | 76 static void getPref(DOMString name, GetPrefCallback callback); |
| 77 | 77 |
| 78 // Gets the page zoom factor as an integer percentage. | 78 // Gets the default page zoom factor. Possible values are currently between |
| 79 static void getDefaultZoomPercent(GetDefaultZoomPercentCallback callback); | 79 // 0.25 and 5. For a full list, see zoom::kPresetZoomFactors. |
| 80 static void getDefaultZoom(GetDefaultZoomCallback callback); |
| 80 | 81 |
| 81 // Sets the page zoom factor from a zoom percentage. | 82 // Sets the page zoom factor. Must be less than 0.001 different than a value |
| 82 static void setDefaultZoomPercent(double percent, | 83 // in zoom::kPresetZoomFactors. |
| 83 optional SetDefaultZoomPercentCallback callback); | 84 static void setDefaultZoom( |
| 85 double zoom, optional SetDefaultZoomCallback callback); |
| 84 }; | 86 }; |
| 85 | 87 |
| 86 interface Events { | 88 interface Events { |
| 87 // Fired when a set of prefs has changed. | 89 // Fired when a set of prefs has changed. |
| 88 // | 90 // |
| 89 // |prefs| The prefs that changed. | 91 // |prefs| The prefs that changed. |
| 90 static void onPrefsChanged(PrefObject[] prefs); | 92 static void onPrefsChanged(PrefObject[] prefs); |
| 91 }; | 93 }; |
| 92 }; | 94 }; |
| OLD | NEW |