1 /* 2 * Copyright (c) 2023-2023 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 OHOS_JS_EXTENSION_WINDOW_UTILS_H 17 #define OHOS_JS_EXTENSION_WINDOW_UTILS_H 18 19 #include <map> 20 #include "js_runtime_utils.h" 21 #include "native_engine/native_engine.h" 22 #include "native_engine/native_value.h" 23 #include "window.h" 24 #include "window_option.h" 25 #include "wm_common.h" 26 27 #ifndef WINDOW_PREVIEW 28 #include "window_manager.h" 29 #else 30 #include "mock/window_manager.h" 31 #endif 32 33 namespace OHOS { 34 namespace Rosen { 35 enum class ComponentRectChangeReason : uint32_t { 36 HOST_WINDOW_RECT_CHANGE = 1, 37 }; 38 napi_value GetRectAndConvertToJsValue(napi_env env, const Rect& rect); 39 napi_value ConvertAvoidAreaToJsValue(napi_env env, const AvoidArea& avoidArea, AvoidAreaType type); 40 napi_value CreateJsExtensionWindowPropertiesObject(napi_env env, sptr<Window>& window); 41 napi_value CreateJsExtensionWindowProperties(napi_env env, sptr<Window>& window); 42 bool NapiIsCallable(napi_env env, napi_value value); 43 napi_value NapiGetUndefined(napi_env env); 44 napi_value NapiThrowError(napi_env env, WmErrorCode errCode); 45 } // namespace Rosen 46 } // namespace OHOS 47 #endif // OHOS_JS_EXTENSION_WINDOW_UTILS_H 48