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 WINDOW_EXTENSION_STUB_IMPL_H
17 #define WINDOW_EXTENSION_STUB_IMPL_H
18 
19 #include <mutex>
20 #include <string>
21 
22 #include "window.h"
23 #include "window_extension_stub.h"
24 #include "window_extension_client_interface.h"
25 #include "wm_common.h"
26 
27 namespace OHOS {
28 namespace Rosen {
29 class WindowExtensionStubImpl : public WindowExtensionStub {
30 public:
31     explicit WindowExtensionStubImpl(const std::string& windowName);
32     ~WindowExtensionStubImpl();
33 
34     virtual void SetBounds(const Rect& rect) override;
35     virtual void Hide() override;
36     virtual void Show() override;
37     virtual void RequestFocus() override;
38     virtual void GetExtensionWindow(sptr<IWindowExtensionClient>& token) override;
39 
40     sptr<Window> CreateWindow(
41         const Rect& rect, uint32_t parentWindowId, const std::shared_ptr<AbilityRuntime::Context>& context,
42         const sptr<IRemoteObject>& iSession = nullptr);
43     void DestroyWindow();
44     sptr<Window> GetWindow() const;
45 private:
46     sptr<IDispatchInputEventListener> dispatchInputEventListener_;
47     wptr<Window> window_;
48     std::string windowName_;
49     sptr<IWindowExtensionClient> token_;
50     std::mutex mutex_;
51 };
52 } // namespace Rosen
53 } // namespace OHOS
54 #endif // WINDOW_EXTENSION_STUB_IMPL_H