File: side_panel.idl

package info (click to toggle)
chromium 141.0.7390.107-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 6,246,132 kB
  • sloc: cpp: 35,264,965; ansic: 7,169,920; javascript: 4,250,185; python: 1,460,635; asm: 950,788; xml: 751,751; pascal: 187,972; sh: 89,459; perl: 88,691; objc: 79,953; sql: 53,924; cs: 44,622; fortran: 24,137; makefile: 22,313; tcl: 15,277; php: 14,018; yacc: 8,995; ruby: 7,553; awk: 3,720; lisp: 3,096; lex: 1,330; ada: 727; jsp: 228; sed: 36
file content (169 lines) | stat: -rw-r--r-- 6,603 bytes parent folder | download | duplicates (4)
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
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
// Copyright 2022 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 `chrome.sidePanel` API to host content in the browser's side panel
// alongside the main content of a webpage.
namespace sidePanel {
  dictionary SidePanel {
    // Developer specified path for side panel display.
    DOMString default_path;
  };

  dictionary ManifestKeys {
    SidePanel side_panel;
  };

  // Defines the possible alignment for the side panel in the browser UI.
  enum Side {
    left,
    right
  };

  // Represents the layout of the side panel, indicating which side it is shown.
  dictionary PanelLayout {
    Side side;
  };

  // The options used when setting a side panel. Omitted properties are
  // unchanged.
  dictionary PanelOptions {
    // If specified, the side panel options will only apply to the tab with
    // this id. If omitted, these options set the default behavior (used for any
    // tab that doesn't have specific settings). Note: if the same path is set
    // for this tabId and the default tabId, then the panel for this tabId will
    // be a different instance than the panel for the default tabId.
    long? tabId;
    // The path to the side panel HTML file to use. This must be a local
    // resource within the extension package.
    DOMString? path;
    // Whether the side panel should be enabled. This is optional. The default
    // value is true.
    boolean? enabled;
  };

  // A dictionary containing the extension's options for how its side panel
  // behaves.
  dictionary PanelBehavior {
    // Whether clicking the extension's icon will toggle showing the extension's
    // entry in the side panel. Defaults to false.
    boolean? openPanelOnActionClick;
  };

  dictionary GetPanelOptions {
    // If specified, the side panel options for the given tab will be returned.
    // Otherwise, returns the default side panel options (used for any tab that
    // doesn't have specific settings).
    long? tabId;
  };

  // Options for opening the side panel.
  // At least one of `tabId` or `windowId` must be specified.
  dictionary OpenOptions {
    // The window in which to open the side panel. This is only applicable if
    // the extension has a global (non-tab-specific) side panel or
    // <code>tabId</code> is also specified. This will override any
    // currently-active global side panel the user has open in the given
    // window. At least one of this or <code>tabId</code> must be provided.
    long? windowId;

    // The tab in which to open the side panel. If the corresponding tab has
    // a tab-specific side panel, the panel will only be open for that tab.
    // If there is not a tab-specific panel, the global panel will be open in
    // the specified tab and any other tabs without a currently-open tab-
    // specific panel. This will override any currently-active side panel
    // (global or tab-specific) in the corresponding tab. At least one of this
    // or <code>windowId</code> must be provided.
    long? tabId;
  };

  // Options for closing the side panel.
  // At least one of `tabId` or `windowId` must be specified.
  dictionary CloseOptions {
    // The window in which to close the side panel. If a global side panel is
    // open in the specified window, it will be closed for all tabs in that
    // window where no tab-specific panel is active. At least one of this or
    // <code>tabId</code> must be provided.
    long? windowId;

    // The tab in which to close the side panel. If a tab-specific side panel
    // is open in the specified tab, it will be closed for that tab.
    // At least one of this or <code>windowId</code> must be provided.
    long? tabId;
  };

  // Information about the opened side panel. It is fired when the extension's
  // side panel is opened.
  dictionary PanelOpenedInfo {
    // The ID of the window where the side panel is opened. This is available
    // for both global and tab-specific panels.
    long windowId;

    // The optional ID of the tab where the side panel is opened. This is
    // provided only when the panel is tab-specific.
    long? tabId;

    // The path of the local resource within the extension package whose content
    // is displayed in the panel.
    DOMString path;
  };

  callback VoidCallback = void();
  callback PanelOptionsCallback = void(PanelOptions options);
  callback PanelBehaviorCallback = void(PanelBehavior behavior);
  callback PanelLayoutCallback = void(PanelLayout layout);

  interface Functions {
    // Configures the side panel.
    // |options|: The configuration options to apply to the panel.
    // |callback|: Invoked when the options have been set.
    static void setOptions(
        PanelOptions options,
        optional VoidCallback callback);

    // Returns the active panel configuration.
    // |options|: Specifies the context to return the configuration for.
    // |callback|: Called with the active panel configuration.
    static void getOptions(
        GetPanelOptions options,
        PanelOptionsCallback callback);

    // Configures the extension's side panel behavior. This is an upsert
    // operation.
    // |behavior|: The new behavior to be set.
    // |callback|: Called when the new behavior has been set.
    static void setPanelBehavior(
        PanelBehavior behavior,
        optional VoidCallback callback);

    // Returns the extension's current side panel behavior.
    // |callback|: Called with the extension's side panel behavior.
    static void getPanelBehavior(
        PanelBehaviorCallback callback);

    // Opens the side panel for the extension.
    // This may only be called in response to a user action.
    // |options|: Specifies the context in which to open the side panel.
    // |callback|: Called when the side panel has been opened.
    static void open(
        OpenOptions options,
        VoidCallback callback);

    // Returns the side panel's current layout.
    // |callback|: Called with a $(ref:PanelLayout) containing the side value.
    static void getLayout(PanelLayoutCallback callback);

    // Closes the extension's side panel.
    // This is a no-op if the panel is already closed.
    // |options|: Specifies the context in which to close the side panel.
    // |callback|: Called when the side panel has been closed.
    [nodoc] static void close(
        CloseOptions options,
        VoidCallback callback);
  };

  interface Events {
    // Fired when the extension's side panel is opened.
    static void onOpened(PanelOpenedInfo info);
  };
};