123b3eb3cSopenharmony_ci/* 223b3eb3cSopenharmony_ci * Copyright (c) 2021-2022 Huawei Device Co., Ltd. 323b3eb3cSopenharmony_ci * Licensed under the Apache License, Version 2.0 (the "License"); 423b3eb3cSopenharmony_ci * you may not use this file except in compliance with the License. 523b3eb3cSopenharmony_ci * You may obtain a copy of the License at 623b3eb3cSopenharmony_ci * 723b3eb3cSopenharmony_ci * http://www.apache.org/licenses/LICENSE-2.0 823b3eb3cSopenharmony_ci * 923b3eb3cSopenharmony_ci * Unless required by applicable law or agreed to in writing, software 1023b3eb3cSopenharmony_ci * distributed under the License is distributed on an "AS IS" BASIS, 1123b3eb3cSopenharmony_ci * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 1223b3eb3cSopenharmony_ci * See the License for the specific language governing permissions and 1323b3eb3cSopenharmony_ci * limitations under the License. 1423b3eb3cSopenharmony_ci */ 1523b3eb3cSopenharmony_ci 1623b3eb3cSopenharmony_ci#ifndef FOUNDATION_ACE_ADAPTER_PREVIEW_ACE_RUN_OPTIONS_H 1723b3eb3cSopenharmony_ci#define FOUNDATION_ACE_ADAPTER_PREVIEW_ACE_RUN_OPTIONS_H 1823b3eb3cSopenharmony_ci 1923b3eb3cSopenharmony_ci#include <functional> 2023b3eb3cSopenharmony_ci#include <string> 2123b3eb3cSopenharmony_ci#include <map> 2223b3eb3cSopenharmony_ci 2323b3eb3cSopenharmony_ci#include "base/utils/device_config.h" 2423b3eb3cSopenharmony_ci#include "base/utils/device_type.h" 2523b3eb3cSopenharmony_ci#include "base/utils/macros.h" 2623b3eb3cSopenharmony_ci 2723b3eb3cSopenharmony_cinamespace OHOS::Ace::Platform { 2823b3eb3cSopenharmony_ci 2923b3eb3cSopenharmony_ciusing SendRenderDataCallback = bool (*)(const void*, const size_t, const int32_t, const int32_t, const uint64_t); 3023b3eb3cSopenharmony_ciusing SendCurrentRouterCallback = bool (*)(const std::string currentRouterPath); 3123b3eb3cSopenharmony_ciusing FastPreviewErrorCallback = void (*)(const std::string& jsonStr); 3223b3eb3cSopenharmony_ci 3323b3eb3cSopenharmony_ciconstexpr uint32_t THEME_ID_LIGHT = 117440515; 3423b3eb3cSopenharmony_ciconstexpr uint32_t THEME_ID_DARK = 117440516; 3523b3eb3cSopenharmony_ci 3623b3eb3cSopenharmony_cienum class AceVersion { 3723b3eb3cSopenharmony_ci ACE_1_0, 3823b3eb3cSopenharmony_ci ACE_2_0, 3923b3eb3cSopenharmony_ci}; 4023b3eb3cSopenharmony_ci 4123b3eb3cSopenharmony_cienum class ProjectModel { 4223b3eb3cSopenharmony_ci FA, 4323b3eb3cSopenharmony_ci STAGE, 4423b3eb3cSopenharmony_ci}; 4523b3eb3cSopenharmony_ci 4623b3eb3cSopenharmony_cistruct ACE_FORCE_EXPORT AceRunArgs { 4723b3eb3cSopenharmony_ci // the adopted project model 4823b3eb3cSopenharmony_ci ProjectModel projectModel = ProjectModel::FA; 4923b3eb3cSopenharmony_ci // stores routing information 5023b3eb3cSopenharmony_ci std::string pageProfile = ""; 5123b3eb3cSopenharmony_ci // The absolute path end of "default". 5223b3eb3cSopenharmony_ci std::string assetPath; 5323b3eb3cSopenharmony_ci // The absolute path of system resources. 5423b3eb3cSopenharmony_ci std::string systemResourcesPath; 5523b3eb3cSopenharmony_ci // The absolute path of app resources. 5623b3eb3cSopenharmony_ci std::string appResourcesPath; 5723b3eb3cSopenharmony_ci 5823b3eb3cSopenharmony_ci // Indicate light or dark theme. 5923b3eb3cSopenharmony_ci uint32_t themeId = THEME_ID_LIGHT; 6023b3eb3cSopenharmony_ci 6123b3eb3cSopenharmony_ci OHOS::Ace::DeviceConfig deviceConfig = { 6223b3eb3cSopenharmony_ci .orientation = DeviceOrientation::PORTRAIT, 6323b3eb3cSopenharmony_ci .density = 1.0, 6423b3eb3cSopenharmony_ci .deviceType = DeviceType::PHONE, 6523b3eb3cSopenharmony_ci .colorMode = ColorMode::LIGHT, 6623b3eb3cSopenharmony_ci }; 6723b3eb3cSopenharmony_ci 6823b3eb3cSopenharmony_ci // Set page path to launch directly, or launch the main page in default. 6923b3eb3cSopenharmony_ci std::string url; 7023b3eb3cSopenharmony_ci 7123b3eb3cSopenharmony_ci std::string windowTitle; 7223b3eb3cSopenharmony_ci 7323b3eb3cSopenharmony_ci bool isRound = false; 7423b3eb3cSopenharmony_ci int32_t viewWidth = 0; 7523b3eb3cSopenharmony_ci int32_t viewHeight = 0; 7623b3eb3cSopenharmony_ci int32_t deviceWidth = 0; 7723b3eb3cSopenharmony_ci int32_t deviceHeight = 0; 7823b3eb3cSopenharmony_ci 7923b3eb3cSopenharmony_ci // Locale 8023b3eb3cSopenharmony_ci std::string language = "zh"; 8123b3eb3cSopenharmony_ci std::string region = "CN"; 8223b3eb3cSopenharmony_ci std::string script = ""; 8323b3eb3cSopenharmony_ci 8423b3eb3cSopenharmony_ci std::string configChanges; 8523b3eb3cSopenharmony_ci 8623b3eb3cSopenharmony_ci AceVersion aceVersion = AceVersion::ACE_1_0; 8723b3eb3cSopenharmony_ci 8823b3eb3cSopenharmony_ci bool formsEnabled = false; 8923b3eb3cSopenharmony_ci 9023b3eb3cSopenharmony_ci SendRenderDataCallback onRender = nullptr; 9123b3eb3cSopenharmony_ci SendCurrentRouterCallback onRouterChange = nullptr; 9223b3eb3cSopenharmony_ci FastPreviewErrorCallback onError = nullptr; 9323b3eb3cSopenharmony_ci 9423b3eb3cSopenharmony_ci // Container sdk path. 9523b3eb3cSopenharmony_ci std::string containerSdkPath = ""; 9623b3eb3cSopenharmony_ci bool isComponentMode = false; 9723b3eb3cSopenharmony_ci 9823b3eb3cSopenharmony_ci // for strict mode 9923b3eb3cSopenharmony_ci std::map<std::string, std::string> pkgContextInfoJsonStringMap; 10023b3eb3cSopenharmony_ci std::map<std::string, std::string> packageNameList; 10123b3eb3cSopenharmony_ci 10223b3eb3cSopenharmony_ci#ifdef COMPONENT_TEST_ENABLED 10323b3eb3cSopenharmony_ci // Component test 10423b3eb3cSopenharmony_ci bool isComponentTestMode = false; 10523b3eb3cSopenharmony_ci std::string componentTestConfig = ""; 10623b3eb3cSopenharmony_ci#endif // COMPONENT_TEST_ENABLED 10723b3eb3cSopenharmony_ci}; 10823b3eb3cSopenharmony_ci 10923b3eb3cSopenharmony_ci} // namespace OHOS::Ace::Platform 11023b3eb3cSopenharmony_ci 11123b3eb3cSopenharmony_ci#endif // FOUNDATION_ACE_ADAPTER_PREVIEW_ACE_RUN_OPTIONS_H 112