1 /*
2  * Copyright (c) 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 #include "extension_window_impl.h"
17 #include "window_manager_hilog.h"
18 #include "wm_common.h"
19 
20 namespace OHOS {
21 namespace Rosen {
22 namespace {
23 constexpr HiviewDFX::HiLogLabel LABEL = {LOG_CORE, HILOG_DOMAIN_WINDOW, "ExtensionWindowImpl"};
24 }
25 
ExtensionWindowImpl(sptr<Window> sessionImpl)26 Rosen::ExtensionWindowImpl::ExtensionWindowImpl(sptr<Window> sessionImpl)
27     : windowExtensionSessionImpl_(sessionImpl) {
28 }
29 
~ExtensionWindowImpl()30 ExtensionWindowImpl::~ExtensionWindowImpl() {}
31 
GetAvoidAreaByType(AvoidAreaType type,AvoidArea & avoidArea)32 WMError ExtensionWindowImpl::GetAvoidAreaByType(AvoidAreaType type, AvoidArea& avoidArea)
33 {
34     WLOGI("GetAvoidAreaByType is called");
35     return windowExtensionSessionImpl_->GetAvoidAreaByType(type, avoidArea);
36 }
37 
GetWindow()38 sptr<Window> ExtensionWindowImpl::GetWindow()
39 {
40     return windowExtensionSessionImpl_;
41 }
42 
HideNonSecureWindows(bool shouldHide)43 WMError ExtensionWindowImpl::HideNonSecureWindows(bool shouldHide)
44 {
45     TLOGI(WmsLogTag::WMS_UIEXT, "HideNonSecureWindows is called");
46     return windowExtensionSessionImpl_->HideNonSecureWindows(shouldHide);
47 }
48 
SetWaterMarkFlag(bool isEnable)49 WMError ExtensionWindowImpl::SetWaterMarkFlag(bool isEnable)
50 {
51     TLOGI(WmsLogTag::WMS_UIEXT, "SetWaterMarkFlag is called");
52     return windowExtensionSessionImpl_->SetWaterMarkFlag(isEnable);
53 }
54 
HidePrivacyContentForHost(bool needHide)55 WMError ExtensionWindowImpl::HidePrivacyContentForHost(bool needHide)
56 {
57     TLOGD(WmsLogTag::WMS_UIEXT, "enter");
58     return windowExtensionSessionImpl_->HidePrivacyContentForHost(needHide);
59 }
60 
IsPcWindow() const61 bool ExtensionWindowImpl::IsPcWindow() const
62 {
63     TLOGI(WmsLogTag::WMS_UIEXT, "in");
64     return windowExtensionSessionImpl_->IsPcWindow();
65 }
66 
IsPcOrPadFreeMultiWindowMode() const67 bool ExtensionWindowImpl::IsPcOrPadFreeMultiWindowMode() const
68 {
69     TLOGI(WmsLogTag::WMS_UIEXT, "in");
70     return windowExtensionSessionImpl_->IsPcOrPadFreeMultiWindowMode();
71 }
72 } // namespace Rosen
73 } // namespace OHOS
74