• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2024 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef GEOLOCATION_PERMISSION_H
17 #define GEOLOCATION_PERMISSION_H
18 
19 #include <cstddef>
20 #include <iosfwd>
21 #include <string>
22 
23 namespace OHOS {
24 namespace NWeb {
25 class GeolocationPermission {
26 public:
GeolocationPermission()27     GeolocationPermission() {}
28 
29     ~GeolocationPermission() = default;
30 
31     static void CjAllowGeolocation(std::string origin, bool incognitoMode, int32_t *errCode);
32 
33     static void CjDeleteGeolocation(std::string origin, bool incognitoMode, int32_t *errCode);
34 
35     static bool CjGetAccessibleGeolocation(std::string origin, bool incognitoMode, int32_t *errCode);
36 
37     static std::vector<std::string> CjGetStoredGeolocation(bool incognitoMode, int32_t *errCode);
38 
39     static void CjDeleteAllGeolocation(bool incognitoMode, int32_t *errCode);
40 
41 private:
42     static void ProcessActionByType(std::string origin, bool incognitoMode,
43         int32_t operationType, int32_t *errCode);
44 
45     static bool ExecuteGetPermissionState(std::string origin, bool incognitoMode, int32_t *errCode);
46 
47     static std::vector<std::string> ExecuteGetOrigins(bool incognitoMode, int32_t *errCode);
48 };
49 } // namespace NWeb
50 } // namespace OHOS
51 
52 #endif // GEOLOCATION_PERMISSION_H
53