1 /* 2 * Copyright (c) 2022 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 GRANT_URI_PERMISSION_H 17 #define GRANT_URI_PERMISSION_H 18 19 #include "filemgmt_libn.h" 20 #include "iremote_broker.h" 21 22 namespace OHOS { 23 namespace AppFileService { 24 namespace ModuleFileShare { 25 26 using namespace std; 27 28 const string MEDIA_GRANT_URI_PERMISSION = 29 "datashare:///media/bundle_permission_insert_operation/bundle_permission_insert_operation"; 30 const string MEDIALIBRARY_DATA_URI = "datashare:///media"; 31 const string MEDIA_FILEMODE_READONLY = "r"; 32 const string GRANT_URI_NAME = "file_share_grant_uri_permission"; 33 const string MEDIA_API_VERSION_10 = "?api_version=10"; 34 const string PERMISSION_BUNDLE_NAME = "bundle_name"; 35 const string PERMISSION_FILE_ID = "file_id"; 36 const string PERMISSION_MODE = "mode"; 37 const string MEDIA_AUTHORITY = "media"; 38 const string FILE_SCHEME = "file"; 39 const string PERMISSION_TABLE_TYPE = "table_type"; 40 const string FILE_MANAGER_AUTHORITY = "docs"; 41 const string MEDIA_FILE_URI_PHOTO_PREFEX = "file://media/Photo/"; 42 const string MEDIA_FILE_URI_AUDIO_PREFEX = "file://media/Audio/"; 43 const string MEDIA_FILE_URI_VIDEO_PREFEX = "file://media/video/"; 44 const string MEDIA_FILE_URI_IMAGE_PREFEX = "file://media/image/"; 45 const string MEDIA_FILE_URI_FILE_PREFEX = "file://media/file/"; 46 const string MEDIA_FILE_URI_Audio_PREFEX = "file://media/audio/"; 47 48 class FileShareGrantToken : public IRemoteBroker { 49 public: 50 DECLARE_INTERFACE_DESCRIPTOR(u"ohos.fileshare.grantUriPermission"); 51 52 FileShareGrantToken() = default; 53 virtual ~FileShareGrantToken() noexcept = default; 54 }; 55 56 class GrantUriPermission final { 57 public: 58 static napi_value Async(napi_env env, napi_callback_info info); 59 }; 60 } // namespace ModuleFileShare 61 } // namespace AppFileService 62 } // namespace OHOS 63 #endif // GRANT_URI_PERMISSION_H 64