161847f8eSopenharmony_ci/*
261847f8eSopenharmony_ci * Copyright (c) 2023 Huawei Device Co., Ltd.
361847f8eSopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License");
461847f8eSopenharmony_ci * you may not use this file except in compliance with the License.
561847f8eSopenharmony_ci * You may obtain a copy of the License at
661847f8eSopenharmony_ci *
761847f8eSopenharmony_ci *     http://www.apache.org/licenses/LICENSE-2.0
861847f8eSopenharmony_ci *
961847f8eSopenharmony_ci * Unless required by applicable law or agreed to in writing, software
1061847f8eSopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS,
1161847f8eSopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1261847f8eSopenharmony_ci * See the License for the specific language governing permissions and
1361847f8eSopenharmony_ci * limitations under the License.
1461847f8eSopenharmony_ci */
1561847f8eSopenharmony_ci
1661847f8eSopenharmony_ci/**
1761847f8eSopenharmony_ci * @file
1861847f8eSopenharmony_ci * @kit MDMKit
1961847f8eSopenharmony_ci */
2061847f8eSopenharmony_ci
2161847f8eSopenharmony_ciimport type { AsyncCallback } from './@ohos.base';
2261847f8eSopenharmony_ciimport type Want from './@ohos.app.ability.Want';
2361847f8eSopenharmony_ci
2461847f8eSopenharmony_ci/**
2561847f8eSopenharmony_ci * This module provides the capability to manage the browser policies of the enterprise devices.
2661847f8eSopenharmony_ci *
2761847f8eSopenharmony_ci * @namespace browser
2861847f8eSopenharmony_ci * @syscap SystemCapability.Customization.EnterpriseDeviceManager
2961847f8eSopenharmony_ci * @since 10
3061847f8eSopenharmony_ci */
3161847f8eSopenharmony_cideclare namespace browser {
3261847f8eSopenharmony_ci  /**
3361847f8eSopenharmony_ci   * Allow the administrator to set the browser policies.
3461847f8eSopenharmony_ci   * This function can be called by a super administrator.
3561847f8eSopenharmony_ci   *
3661847f8eSopenharmony_ci   * @permission ohos.permission.ENTERPRISE_SET_BROWSER_POLICY
3761847f8eSopenharmony_ci   * @param { Want } admin - admin indicates the enterprise admin extension ability information.
3861847f8eSopenharmony_ci   *                         The admin must have the corresponding permission.
3961847f8eSopenharmony_ci   * @param { string } appId - id of the bundle that need to set policies. It cannot be empty.
4061847f8eSopenharmony_ci   * @param { string } policies - browser policies that need to set. It must be a correct JSON character string that
4161847f8eSopenharmony_ci   *                              can be converted into browser policies.
4261847f8eSopenharmony_ci   * @param { AsyncCallback<void> } callback - the callback of setPolicies.
4361847f8eSopenharmony_ci   * @throws { BusinessError } 9200001 - The application is not an administrator application of the device.
4461847f8eSopenharmony_ci   * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device.
4561847f8eSopenharmony_ci   * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API.
4661847f8eSopenharmony_ci   * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API.
4761847f8eSopenharmony_ci   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
4861847f8eSopenharmony_ci   *                                 2. Incorrect parameter types; 3. Parameter verification failed.
4961847f8eSopenharmony_ci   * @syscap SystemCapability.Customization.EnterpriseDeviceManager
5061847f8eSopenharmony_ci   * @systemapi
5161847f8eSopenharmony_ci   * @StageModelOnly
5261847f8eSopenharmony_ci   * @since 10
5361847f8eSopenharmony_ci   */
5461847f8eSopenharmony_ci  function setPolicies(admin: Want, appId: string, policies: string, callback: AsyncCallback<void>): void;
5561847f8eSopenharmony_ci
5661847f8eSopenharmony_ci  /**
5761847f8eSopenharmony_ci   * Allow the administrator to set the browser policies.
5861847f8eSopenharmony_ci   * This function can be called by a super administrator.
5961847f8eSopenharmony_ci   *
6061847f8eSopenharmony_ci   * @permission ohos.permission.ENTERPRISE_SET_BROWSER_POLICY
6161847f8eSopenharmony_ci   * @param { Want } admin - admin indicates the enterprise admin extension ability information.
6261847f8eSopenharmony_ci   *                         The admin must have the corresponding permission.
6361847f8eSopenharmony_ci   * @param { string } appId - id of the bundle that need to set policies. It cannot be empty.
6461847f8eSopenharmony_ci   * @param { string } policies - browser policies that need to set. It must be a correct JSON character string that
6561847f8eSopenharmony_ci   *                              can be converted into browser policies.
6661847f8eSopenharmony_ci   * @returns { Promise<void> } the promise returned by the setPolicies.
6761847f8eSopenharmony_ci   * @throws { BusinessError } 9200001 - The application is not an administrator application of the device.
6861847f8eSopenharmony_ci   * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device.
6961847f8eSopenharmony_ci   * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API.
7061847f8eSopenharmony_ci   * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API.
7161847f8eSopenharmony_ci   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
7261847f8eSopenharmony_ci   *                                 2. Incorrect parameter types; 3. Parameter verification failed.
7361847f8eSopenharmony_ci   * @syscap SystemCapability.Customization.EnterpriseDeviceManager
7461847f8eSopenharmony_ci   * @systemapi
7561847f8eSopenharmony_ci   * @StageModelOnly
7661847f8eSopenharmony_ci   * @since 10
7761847f8eSopenharmony_ci   */
7861847f8eSopenharmony_ci  function setPolicies(admin: Want, appId: string, policies: string): Promise<void>;
7961847f8eSopenharmony_ci
8061847f8eSopenharmony_ci  /**
8161847f8eSopenharmony_ci   * Allow the administrator to get the browser policies.
8261847f8eSopenharmony_ci   * This function can be called by a super administrator.
8361847f8eSopenharmony_ci   *
8461847f8eSopenharmony_ci   * @param { Want } admin - admin indicates the enterprise admin extension ability information.
8561847f8eSopenharmony_ci   *                         The admin must have the corresponding permission.
8661847f8eSopenharmony_ci   * @param { string } appId - id of the bundle that need to set policies. It cannot be empty.
8761847f8eSopenharmony_ci   * @param { AsyncCallback<string> } callback - the callback carries the browser policies returned by the getPolicies.
8861847f8eSopenharmony_ci   * @throws { BusinessError } 9200001 - The application is not an administrator application of the device.
8961847f8eSopenharmony_ci   * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API.
9061847f8eSopenharmony_ci   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
9161847f8eSopenharmony_ci   *                                 2. Incorrect parameter types; 3. Parameter verification failed.
9261847f8eSopenharmony_ci   * @syscap SystemCapability.Customization.EnterpriseDeviceManager
9361847f8eSopenharmony_ci   * @systemapi
9461847f8eSopenharmony_ci   * @StageModelOnly
9561847f8eSopenharmony_ci   * @since 10
9661847f8eSopenharmony_ci   */
9761847f8eSopenharmony_ci  function getPolicies(admin: Want, appId: string, callback: AsyncCallback<string>): void;
9861847f8eSopenharmony_ci
9961847f8eSopenharmony_ci  /**
10061847f8eSopenharmony_ci   * Allow the administrator to get the browser policies.
10161847f8eSopenharmony_ci   * This function can be called by a super administrator.
10261847f8eSopenharmony_ci   *
10361847f8eSopenharmony_ci   * @param { Want } admin - admin indicates the enterprise admin extension ability information.
10461847f8eSopenharmony_ci   *                         The admin must have the corresponding permission.
10561847f8eSopenharmony_ci   * @param { string } appId - id of the bundle that need to set policies. It cannot be empty.
10661847f8eSopenharmony_ci   * @returns { Promise<string> } the promise carries the browser policies returned by the getPolicies.
10761847f8eSopenharmony_ci   * @throws { BusinessError } 9200001 - The application is not an administrator application of the device.
10861847f8eSopenharmony_ci   * @throws { BusinessError } 202 - Permission verification failed. A non-system application calls a system API.
10961847f8eSopenharmony_ci   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
11061847f8eSopenharmony_ci   *                                 2. Incorrect parameter types; 3. Parameter verification failed.
11161847f8eSopenharmony_ci   * @syscap SystemCapability.Customization.EnterpriseDeviceManager
11261847f8eSopenharmony_ci   * @systemapi
11361847f8eSopenharmony_ci   * @StageModelOnly
11461847f8eSopenharmony_ci   * @since 10
11561847f8eSopenharmony_ci   */
11661847f8eSopenharmony_ci  function getPolicies(admin: Want, appId: string): Promise<string>;
11761847f8eSopenharmony_ci
11861847f8eSopenharmony_ci  /**
11961847f8eSopenharmony_ci   * Sets the browser policy.
12061847f8eSopenharmony_ci   * This function can be called by a super administrator.
12161847f8eSopenharmony_ci   *
12261847f8eSopenharmony_ci   * @permission ohos.permission.ENTERPRISE_SET_BROWSER_POLICY
12361847f8eSopenharmony_ci   * @param { Want } admin - admin indicates the enterprise admin extension ability information.
12461847f8eSopenharmony_ci   *                         The admin must have the corresponding permission.
12561847f8eSopenharmony_ci   * @param { string } appId - appId indicates the id of the bundle that need to set policy. It cannot be empty.
12661847f8eSopenharmony_ci   * @param { string } policyName - policyName indicates the browser policy name that need to set.
12761847f8eSopenharmony_ci   * @param { string } policyValue - policyValue indicates the browser policy value that need to set. It must be a
12861847f8eSopenharmony_ci   *                                 correct JSON character string that can be converted into browser policies.
12961847f8eSopenharmony_ci   * @throws { BusinessError } 9200001 - The application is not an administrator application of the device.
13061847f8eSopenharmony_ci   * @throws { BusinessError } 9200002 - The administrator application does not have permission to manage the device.
13161847f8eSopenharmony_ci   * @throws { BusinessError } 201 - Permission verification failed. The application does not have the permission required to call the API.
13261847f8eSopenharmony_ci   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
13361847f8eSopenharmony_ci   *                                 2. Incorrect parameter types; 3. Parameter verification failed.
13461847f8eSopenharmony_ci   * @syscap SystemCapability.Customization.EnterpriseDeviceManager
13561847f8eSopenharmony_ci   * @stagemodelonly
13661847f8eSopenharmony_ci   * @since 12
13761847f8eSopenharmony_ci   */
13861847f8eSopenharmony_ci  function setPolicySync(admin: Want, appId: string, policyName: string, policyValue: string): void;
13961847f8eSopenharmony_ci
14061847f8eSopenharmony_ci  /**
14161847f8eSopenharmony_ci   * Gets the browser policies.
14261847f8eSopenharmony_ci   * This function can be called by a super administrator.
14361847f8eSopenharmony_ci   *
14461847f8eSopenharmony_ci   * @param { Want } admin - admin indicates the enterprise admin extension ability information.
14561847f8eSopenharmony_ci   *                         The admin must have the corresponding permission.
14661847f8eSopenharmony_ci   * @param { string } appId - id of the bundle that need to get policies. It cannot be empty.
14761847f8eSopenharmony_ci   * @returns { string } the browser policies returned by the getPolicies.
14861847f8eSopenharmony_ci   * @throws { BusinessError } 9200001 - The application is not an administrator application of the device.
14961847f8eSopenharmony_ci   * @throws { BusinessError } 401 - Parameter error. Possible causes: 1. Mandatory parameters are left unspecified;
15061847f8eSopenharmony_ci   *                                 2. Incorrect parameter types; 3. Parameter verification failed.
15161847f8eSopenharmony_ci   * @syscap SystemCapability.Customization.EnterpriseDeviceManager
15261847f8eSopenharmony_ci   * @stagemodelonly
15361847f8eSopenharmony_ci   * @since 12
15461847f8eSopenharmony_ci   */
15561847f8eSopenharmony_ci    function getPoliciesSync(admin: Want, appId: string): string;
15661847f8eSopenharmony_ci}
15761847f8eSopenharmony_ci
15861847f8eSopenharmony_ciexport default browser;
159