• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_H
17 #define OHOS_JS_EXTENSION_WINDOW_H
18 
19 #include "extension_window.h"
20 #include "extension_window_impl.h"
21 #include "js_extension_window_register_manager.h"
22 #include "native_engine/native_engine.h"
23 #include "native_engine/native_reference.h"
24 #include "native_engine/native_value.h"
25 
26 namespace OHOS {
27 namespace Rosen {
28 class JsExtensionWindow {
29 public:
30     explicit JsExtensionWindow(const std::shared_ptr<Rosen::ExtensionWindow> extensionWindow);
31     ~JsExtensionWindow();
32     static napi_value CreateJsExtensionWindow(napi_env env, sptr<Rosen::Window> window);
33     static void Finalizer(napi_env env, void* data, void* hint);
34     static napi_value GetWindowAvoidArea(napi_env env, napi_callback_info info);
35     static napi_value RegisterExtensionWindowCallback(napi_env env, napi_callback_info info);
36     static napi_value UnRegisterExtensionWindowCallback(napi_env env, napi_callback_info info);
37     static napi_value HideNonSecureWindows(napi_env env, napi_callback_info info);
38 private:
39     napi_value OnGetWindowAvoidArea(napi_env env, napi_callback_info info);
40     napi_value OnRegisterExtensionWindowCallback(napi_env env, napi_callback_info info);
41     napi_value OnUnRegisterExtensionWindowCallback(napi_env env, napi_callback_info info);
42     napi_value OnHideNonSecureWindows(napi_env env, napi_callback_info info);
43 
44     static napi_value GetProperties(napi_env env, napi_callback_info info);
45 
46     std::shared_ptr<Rosen::ExtensionWindow> extensionWindow_;
47     std::unique_ptr<JsExtensionWindowRegisterManager> extensionRegisterManager_ = nullptr;
48 };
49 }  // namespace Rosen
50 }  // namespace OHOS
51 #endif  // OHOS_JS_EXTENSION_WINDOW_H
52