1/* Copyright 2012 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
6/**
7 * This file contains the <code>PPP_Flash_BrowserOperations</code> interface.
8 */
9
10label Chrome {
11  M20 = 1.0,
12  M21 = 1.2,
13  M22 = 1.3
14};
15
16[assert_size(4)]
17enum PP_Flash_BrowserOperations_SettingType {
18  PP_FLASH_BROWSEROPERATIONS_SETTINGTYPE_CAMERAMIC = 0,
19  PP_FLASH_BROWSEROPERATIONS_SETTINGTYPE_PEERNETWORKING = 1
20};
21
22[assert_size(4)]
23enum PP_Flash_BrowserOperations_Permission {
24  // This value is only used with <code>SetSitePermission()</code>.
25  PP_FLASH_BROWSEROPERATIONS_PERMISSION_DEFAULT = 0,
26  PP_FLASH_BROWSEROPERATIONS_PERMISSION_ALLOW = 1,
27  PP_FLASH_BROWSEROPERATIONS_PERMISSION_BLOCK = 2,
28  PP_FLASH_BROWSEROPERATIONS_PERMISSION_ASK = 3
29};
30
31struct PP_Flash_BrowserOperations_SiteSetting {
32  cstr_t site;
33  PP_Flash_BrowserOperations_Permission permission;
34};
35
36typedef void PPB_Flash_BrowserOperations_GetSettingsCallback(
37    [inout] mem_t user_data,
38    [in] PP_Bool success,
39    [in] PP_Flash_BrowserOperations_Permission default_permission,
40    [in] uint32_t site_count,
41    [in, size_is(site_count)] PP_Flash_BrowserOperations_SiteSetting[] sites);
42
43/**
44 * This interface allows the browser to request the plugin do things.
45 */
46interface PPP_Flash_BrowserOperations {
47  /**
48   * This function allows the plugin to implement the "Clear site data" feature.
49   *
50   * @param[in] plugin_data_path String containing the directory where the
51   * plugin data is
52   * stored. On UTF16 systems (Windows), this will be encoded as UTF-8. It will
53   * be an absolute path and will not have a directory separator (slash) at the
54   * end.
55   * @param[in] site String specifying which site to clear the data for. This
56   * will be null to clear data for all sites.
57   * @param[in] flags Currently always 0 in Chrome to clear all data. This may
58   * be extended in the future to clear only specific types of data.
59   * @param[in] max_age The maximum age in seconds to clear data for. This
60   * allows the plugin to implement "clear past hour" and "clear past data",
61   * etc.
62   *
63   * @return PP_TRUE on success, PP_FALSE on failure.
64   *
65   * See also the NPP_ClearSiteData function in NPAPI.
66   * https://wiki.mozilla.org/NPAPI:ClearSiteData
67   */
68  PP_Bool ClearSiteData([in] str_t plugin_data_path,
69                        [in] str_t site,
70                        [in] uint64_t flags,
71                        [in] uint64_t max_age);
72
73  /**
74   * Requests the plugin to deauthorize content licenses. It prevents Flash from
75   * playing protected content, such as movies and music the user may have
76   * rented or purchased.
77   *
78   * @param[in] plugin_data_path String containing the directory where the
79   * plugin settings are stored.
80   *
81   * @return <code>PP_TRUE</code> on success, <code>PP_FALSE</code> on failure.
82   */
83  [version=1.2]
84  PP_Bool DeauthorizeContentLicenses([in] str_t plugin_data_path);
85
86  /**
87   * Gets permission settings. <code>callback</code> will be called exactly once
88   * to return the settings.
89   *
90   * @param[in] plugin_data_path String containing the directory where the
91   * plugin settings are stored.
92   * @param[in] setting_type What type of setting to retrieve.
93   * @param[in] callback The callback to return retrieved data.
94   * @param[inout] user_data An opaque pointer that will be passed to
95   * <code>callback</code>.
96   */
97  [version=1.2]
98  void GetPermissionSettings(
99      [in] str_t plugin_data_path,
100      [in] PP_Flash_BrowserOperations_SettingType setting_type,
101      [in] PPB_Flash_BrowserOperations_GetSettingsCallback callback,
102      [inout] mem_t user_data);
103
104  /**
105   * Sets default permission. It applies to all sites except those with
106   * site-specific settings.
107   *
108   * @param[in] plugin_data_path String containing the directory where the
109   * plugin settings are stored.
110   * @param[in] setting_type What type of setting to set.
111   * @param[in] permission The default permission.
112   * @param[in] clear_site_specific Whether to remove all site-specific
113   * settings.
114   *
115   * @return <code>PP_TRUE</code> on success, <code>PP_FALSE</code> on failure.
116   */
117  [version=1.2]
118  PP_Bool SetDefaultPermission(
119      [in] str_t plugin_data_path,
120      [in] PP_Flash_BrowserOperations_SettingType setting_type,
121      [in] PP_Flash_BrowserOperations_Permission permission,
122      [in] PP_Bool clear_site_specific);
123
124  /**
125   * Sets site-specific permission. If a site has already got site-specific
126   * permission and it is not in <code>sites</code>, it won't be affected.
127   *
128   * @param[in] plugin_data_path String containing the directory where the
129   * plugin settings are stored.
130   * @param[in] setting_type What type of setting to set.
131   * @param[in] site_count How many items are there in <code>sites</code>.
132   * @param[in] sites The site-specific settings. If a site is specified with
133   * <code>PP_FLASH_BROWSEROPERATIONS_PERMISSION_DEFAULT</code> permission, it
134   * will be removed from the site-specific list.
135   *
136   * @return <code>PP_TRUE</code> on success, <code>PP_FALSE</code> on failure.
137   */
138  [version=1.2]
139  PP_Bool SetSitePermission(
140      [in] str_t plugin_data_path,
141      [in] PP_Flash_BrowserOperations_SettingType setting_type,
142      [in] uint32_t site_count,
143      [in, size_is(site_count)] PP_Flash_BrowserOperations_SiteSetting[] sites);
144
145  /**
146   * Returns a list of sites that have stored data, for use with the
147   * "Clear site data" feature.
148   *
149   * @param[in] plugin_data_path String containing the directory where the
150   * plugin data is stored.
151   * @param[out] sites A NULL-terminated array of sites that have stored data.
152   * Use FreeSiteList on the array when done.
153   *
154   * See also the NPP_GetSitesWithData function in NPAPI:
155   * https://wiki.mozilla.org/NPAPI:ClearSiteData
156   */
157  [version=1.3]
158  void GetSitesWithData([in] str_t plugin_data_path,
159                        [out] str_t[] sites);
160
161  /**
162   * Frees the list of sites returned by GetSitesWithData.
163   *
164   * @param[in] sites A NULL-terminated array of strings.
165   */
166  [version=1.3]
167  void FreeSiteList([inout] str_t[] sites);
168};
169