Ejemplo n.º 1
0
        /// <summary>
        /// Set permission settings for given origin.
        /// </summary>
        /// <param name = "permission">Descriptor of permission to override.</param>
        /// <param name = "setting">Setting of the permission.</param>
        /// <param name = "origin">Origin the permission applies to, all origins if not specified.</param>
        /// <param name = "browserContextId">Context to override. When omitted, default browser context is used.</param>
        /// <returns>returns System.Threading.Tasks.Task&lt;DevToolsMethodResponse&gt;</returns>
        public async System.Threading.Tasks.Task <DevToolsMethodResponse> SetPermissionAsync(CefSharp.DevTools.Browser.PermissionDescriptor permission, CefSharp.DevTools.Browser.PermissionSetting setting, string origin = null, string browserContextId = null)
        {
            ValidateSetPermission(permission, setting, origin, browserContextId);
            var dict = new System.Collections.Generic.Dictionary <string, object>();

            dict.Add("permission", permission.ToDictionary());
            dict.Add("setting", this.EnumToString(setting));
            if (!(string.IsNullOrEmpty(origin)))
            {
                dict.Add("origin", origin);
            }

            if (!(string.IsNullOrEmpty(browserContextId)))
            {
                dict.Add("browserContextId", browserContextId);
            }

            var methodResult = await _client.ExecuteDevToolsMethodAsync("Browser.setPermission", dict);

            return(methodResult);
        }
Ejemplo n.º 2
0
 partial void ValidateSetPermission(CefSharp.DevTools.Browser.PermissionDescriptor permission, CefSharp.DevTools.Browser.PermissionSetting setting, string origin = null, string browserContextId = null);