diff --git a/api/@ohos.web.d.ts b/api/@ohos.web.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..3d462d0bfa3321f2825f775988177889dc08cf3f --- /dev/null +++ b/api/@ohos.web.d.ts @@ -0,0 +1,127 @@ +/* + * Copyright (c) 2021-2022 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import {AsyncCallback} from "./basic"; + +/** + * This module provides the capability to manage web modules. + * + * @since 9 + * @syscap SystemCapability.Web + */ +declare namespace web { + /** + * Provides basic information of web storage. + * @name WebStorageOrigin + * @since 9 + * @syscap SystemCapability.Web + */ + interface WebStorageOrigin { + origin: string; + usage: number; + quota: number; + } + + /** + * Provides methods for managing web storage. + * @name WebStorage + * @since 9 + * @syscap SystemCapability.Web + */ + class WebStorage { + /** + * delete all the storage data. + * + * @since 9 + */ + static deleteAllData() : void; + + /** + * delete the storage data with the origin. + * @param origin the origin which to be deleted. + * @since 9 + */ + static deleteOrigin(origin : string): void; + + /** + * Get current all the web storage origins. + * + * @since 9 + */ + static getOrigins() : Promise>; + static getOrigins(callback: AsyncCallback>) : void; + + /** + * Get the web storage quota with the origin. + * @param origin the origin which to be inquired. + * @since 9 + */ + static getOriginQuota(origin : string) : Promise; + static getOriginQuota(origin : string, callback : AsyncCallback) : void; + + /** + * Get the web storage quota with the origin. + * @param origin the origin which to be inquired. + * @since 9 + */ + static getOriginUsage(origin : string) : Promise ; + static getOriginUsage(origin : string, callback : AsyncCallback) : void; + } + + /** + * Provides methods for managing web database. + * @name WebDataBase + * @since 9 + * @syscap SystemCapability.Web + */ + class WebDataBase { + /** + * Get whether instances holds any http authentication credentials. + * @return true if instances saved any http authentication credentials otherwise false. + * + * @since 9 + */ + static existHttpAuthCredentials(): boolean; + + /** + * delete all http authentication credentials. + * + * @since 9 + */ + static deleteHttpAuthCredentials(): void; + + /** + * get http authentication credentials. + * @param host the host to which the credentials apply. + * @param realm the realm to which the credentials apply. + * @return Return an array containing username and password. + * @since 9 + */ + static getHttpAuthCredentials(host: string, realm: string): Array; + + /** + * save http authentication credentials. + * @param host the host to which the credentials apply. + * @param realm the realm to which the credentials apply. + * @param username the username. + * @param password the password. + * + * @since 9 + */ + static saveHttpAuthCredentials(host: string, realm: string, username: string, password: string): void; + } +} + +export default web; \ No newline at end of file diff --git a/api/device-define/car.json b/api/device-define/car.json index a832561a64dfbf985013b314f62b32ca24ef18b8..41a4eb36fee7c445167aa5eb8349c99b5eae6a8b 100644 --- a/api/device-define/car.json +++ b/api/device-define/car.json @@ -122,6 +122,7 @@ "SystemCapability.Applications.ContactsData", "SystemCapability.Applications.Contacts", "SystemCapability.Applications.settings.Core", - "SystemCapability.Test.UiTest" + "SystemCapability.Test.UiTest", + "SystemCapability.Web" ] } \ No newline at end of file diff --git a/api/device-define/default.json b/api/device-define/default.json index 121cdf64cd4425015fcd42c22b2024749e8d8c9b..e9519ff8415807973b3b74922b3af3146d8b30b4 100644 --- a/api/device-define/default.json +++ b/api/device-define/default.json @@ -151,6 +151,7 @@ "SystemCapability.Applications.ContactsData", "SystemCapability.Applications.Contacts", "SystemCapability.Applications.settings.Core", - "SystemCapability.Test.UiTest" + "SystemCapability.Test.UiTest", + "SystemCapability.Web" ] } diff --git a/api/device-define/tablet.json b/api/device-define/tablet.json index c8d305174e44b25053fb904007badef46c8d4525..d447d9ba67d37ed4d11af611feac056691b0781e 100644 --- a/api/device-define/tablet.json +++ b/api/device-define/tablet.json @@ -150,6 +150,7 @@ "SystemCapability.Applications.ContactsData", "SystemCapability.Applications.Contacts", "SystemCapability.Applications.settings.Core", - "SystemCapability.Test.UiTest" + "SystemCapability.Test.UiTest", + "SystemCapability.Web" ] } \ No newline at end of file diff --git a/api/device-define/tv.json b/api/device-define/tv.json index c992e8cd6327249e7f9cff2c883a934496c09c65..e0d2755f119daa217e60c4859c2d47d21ddb3a48 100644 --- a/api/device-define/tv.json +++ b/api/device-define/tv.json @@ -125,6 +125,7 @@ "SystemCapability.Ability.AbilityTools.AbilityAssistant", "SystemCapability.Ability.Form", "SystemCapability.Ability.DistributedAbilityManager", - "SystemCapability.Applications.settings.Core" + "SystemCapability.Applications.settings.Core", + "SystemCapability.Web" ] } \ No newline at end of file diff --git a/api/device-define/wearable.json b/api/device-define/wearable.json index d312e0ae0080094784083f58c100feebf0b8b5c4..8c9289e4bc59d3bef23238a7f0732afa361d2422 100644 --- a/api/device-define/wearable.json +++ b/api/device-define/wearable.json @@ -127,6 +127,7 @@ "SystemCapability.Ability.DistributedAbilityManager", "SystemCapability.Applications.ContactsData", "SystemCapability.Applications.Contacts", - "SystemCapability.Applications.settings.Core" + "SystemCapability.Applications.settings.Core", + "SystemCapability.Web" ] } \ No newline at end of file