2 * Copyright (c) 2020 Samsung Electronics Co., Ltd.
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
8 * http://www.apache.org/licenses/LICENSE-2.0
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
17 #include <screen_connector_remote_surface_evas/util.h>
21 #include "watch_mirror.hh"
29 #define LOG_TAG "WATCH_HOLDER"
31 using namespace tizen_base;
33 namespace watch_holder {
35 WatchMirror::~WatchMirror() = default;
36 WatchMirror::WatchMirror(Evas_Object* win)
37 : WatchMirrorBase(screen_connector::util::GetWlSurface(win)),
41 void WatchMirror::OnChanged(const ISharableWatchBase& watch) {
44 void WatchMirror::OnChanged(int rid, std::string inst_id, std::string appid) {
45 WatchMirrorBase::AddWatch(make_shared<Watch>(
46 rid, inst_id, appid, viewer_win_, nullptr, this));
47 shared_ptr<ISharableWatchBase> cur = WatchMirrorBase::GetCurrent();
48 OnChanged(*cur.get());
51 shared_ptr<ISharableWatch> WatchMirror::Cast(
52 shared_ptr<ISharableWatchBase> watch) {
53 shared_ptr<Watch> wa = dynamic_pointer_cast<Watch>(watch);
54 return static_pointer_cast<ISharableWatch>(wa);
57 const ISharableWatch& WatchMirror::Cast(const ISharableWatchBase& watch) {
58 const Watch& wa = dynamic_cast<const Watch&>(watch);
59 return (ISharableWatch&)wa;
62 std::shared_ptr<WatchBase> WatchMirror::CreateWatch(int rid, std::string id,
63 std::string appid, bool mock) {
64 return make_shared<Watch>(rid, std::move(id), std::move(appid),
65 viewer_win_, this, mock);
68 std::shared_ptr<WatchBase> WatchMirror::CreateWatch(int rid, std::string id,
69 std::string appid, tizen_base::Bundle extra, bool mock) {
70 return make_shared<Watch>(rid, std::move(id), std::move(appid),
71 viewer_win_, std::move(extra), this, mock);
74 } // namespace watch_holder