Chromium Code Reviews| 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 (long percent); | 60 callback GetDefaultZoomPercentCallback = void (double percent); |
| 61 callback SetDefaultZoomPercentCallback = void (boolean success); | 61 callback SetDefaultZoomPercentCallback = 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 page zoom factor as an integer percentage. |
| 79 static void getDefaultZoomPercent(GetDefaultZoomPercentCallback callback); | 79 static void getDefaultZoomPercent(GetDefaultZoomPercentCallback callback); |
| 80 | 80 |
| 81 // Sets the page zoom factor from a zoom percentage. | 81 // Sets the page zoom factor from a zoom percentage. |
| 82 static void setDefaultZoomPercent(long percent, | 82 static void setDefaultZoomPercent(double percent, |
|
michaelpg
2016/10/17 08:46:08
that is not how percents work... a percent would b
Devlin
2016/10/17 14:51:12
+1
| |
| 83 optional SetDefaultZoomPercentCallback callback); | 83 optional SetDefaultZoomPercentCallback callback); |
| 84 }; | 84 }; |
| 85 | 85 |
| 86 interface Events { | 86 interface Events { |
| 87 // Fired when a set of prefs has changed. | 87 // Fired when a set of prefs has changed. |
| 88 // | 88 // |
| 89 // |prefs| The prefs that changed. | 89 // |prefs| The prefs that changed. |
| 90 static void onPrefsChanged(PrefObject[] prefs); | 90 static void onPrefsChanged(PrefObject[] prefs); |
| 91 }; | 91 }; |
| 92 }; | 92 }; |
| OLD | NEW |