File: settings_private.idl

package info (click to toggle)
chromium 139.0.7258.127-1
  • links: PTS, VCS
  • area: main
  • in suites:
  • size: 6,122,068 kB
  • sloc: cpp: 35,100,771; ansic: 7,163,530; javascript: 4,103,002; python: 1,436,920; asm: 946,517; xml: 746,709; pascal: 187,653; perl: 88,691; sh: 88,436; objc: 79,953; sql: 51,488; cs: 44,583; fortran: 24,137; makefile: 22,147; tcl: 15,277; php: 13,980; yacc: 8,984; ruby: 7,485; awk: 3,720; lisp: 3,096; lex: 1,327; ada: 727; jsp: 228; sed: 36
file content (126 lines) | stat: -rw-r--r-- 4,221 bytes parent folder | download | duplicates (9)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
// Copyright 2015 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

// Use the <code>chrome.settingsPrivate</code> API to get or set preferences
// from the settings UI. Access is restricted to a set of allowed user facing
// preferences.
namespace settingsPrivate {
  enum PrefType { BOOLEAN, NUMBER, STRING, URL, LIST, DICTIONARY };

  enum ControlledBy {
    DEVICE_POLICY,
    USER_POLICY,
    OWNER,
    PRIMARY_USER,
    EXTENSION,

    // Preferences are controlled by the parent of the child user.
    PARENT,

    // Preferences are controlled neither by parent nor the child user.
    // Preference values are hard-coded values and can not be changed.
    CHILD_RESTRICTION
  };

  enum Enforcement {
    // Value cannot be changed by user.
    ENFORCED,
    // Value can be changed, but the administrator recommends a default.
    RECOMMENDED,
    // Value is protected by a code that only parents can access. The logic to
    // require the code is NOT automatically added to a preference using this
    // enforcement. This is only used to display the correct pref indicator.
    PARENT_SUPERVISED
  };

  dictionary PrefObject {
    // The key for the pref.
    DOMString key;

    // The type of the pref (e.g., boolean, string, etc.).
    PrefType type;

    // The current value of the pref.
    any? value;

    // The policy source of the pref; an undefined value means there is no
    // policy.
    ControlledBy? controlledBy;

    // The owner name if controlledBy == OWNER.
    // The primary user name if controlledBy == PRIMARY_USER.
    // The extension name if controlledBy == EXTENSION.
    DOMString? controlledByName;

    // The policy enforcement of the pref; must be specified if controlledBy is
    // also present.
    Enforcement? enforcement;

    // The recommended value if enforcement == RECOMMENDED.
    any? recommendedValue;

    // If enforcement == ENFORCED this optionally specifies preference values
    // that are still available for selection by the user. If set, must contain
    // at least 2 distinct values, as must contain |value| and
    // |recommendedValue| (if present).
    any[]? userSelectableValues;

    // If true, user control of the preference is disabled for reasons unrelated
    // to controlledBy (e.g. no signed-in profile is present). A false value is
    // a no-op.
    boolean? userControlDisabled;

    // The extension ID if controlledBy == EXTENSION.
    DOMString? extensionId;

    // Whether the controlling extension can be disabled if controlledBy ==
    // EXTENSION.
    boolean? extensionCanBeDisabled;
  };

  callback OnPrefSetCallback = void (boolean success);
  callback GetAllPrefsCallback = void (PrefObject[] prefs);
  callback GetPrefCallback = void (PrefObject pref);
  callback GetDefaultZoomCallback = void (double zoom);
  callback SetDefaultZoomCallback = void (boolean success);

  interface Functions {
    // Sets a pref value.
    // |name|: The name of the pref.
    // |value|: The new value of the pref.
    // |pageId|: An optional user metrics identifier.
    // |callback|: The callback for whether the pref was set or not.
    static void setPref(
        DOMString name,
        any value,
        optional DOMString pageId,
        optional OnPrefSetCallback callback);

    // Gets an array of all the prefs.
    static void getAllPrefs(GetAllPrefsCallback callback);

    // Gets the value of a specific pref.
    static void getPref(
        DOMString name,
        GetPrefCallback callback);

    // Gets the default page zoom factor. Possible values are currently between
    // 0.25 and 5. For a full list, see zoom::kPresetBrowserZoomFactors.
    static void getDefaultZoom(
        GetDefaultZoomCallback callback);

    // Sets the page zoom factor. Must be less than 0.001 different than a value
    // in zoom::kPresetBrowserZoomFactors.
    static void setDefaultZoom(
        double zoom,
        optional SetDefaultZoomCallback callback);
  };

  interface Events {
    // Fired when a set of prefs has changed.
    //
    // |prefs| The prefs that changed.
    static void onPrefsChanged(PrefObject[] prefs);
  };
};