mirror of
https://gitee.com/openharmony/arkui_ace_engine
synced 2024-11-23 15:10:30 +00:00
commit
8d8467881b
@ -1745,6 +1745,20 @@ UIContentErrorCode UIContentImpl::CommonInitialize(
|
||||
TaskExecutor::TaskType::UI, "UiSessionGetInspectorTree");
|
||||
};
|
||||
UiSessionManager::GetInstance().SaveInspectorTreeFunction(callback);
|
||||
auto webCallback = [weakContext = WeakPtr(pipeline)](bool isRegister) {
|
||||
auto pipeline = AceType::DynamicCast<NG::PipelineContext>(weakContext.Upgrade());
|
||||
CHECK_NULL_VOID(pipeline);
|
||||
auto taskExecutor = pipeline->GetTaskExecutor();
|
||||
CHECK_NULL_VOID(taskExecutor);
|
||||
taskExecutor->PostTask(
|
||||
[weakContext = WeakPtr(pipeline), isRegister]() {
|
||||
auto pipeline = AceType::DynamicCast<NG::PipelineContext>(weakContext.Upgrade());
|
||||
CHECK_NULL_VOID(pipeline);
|
||||
pipeline->NotifyAllWebPattern(isRegister);
|
||||
},
|
||||
TaskExecutor::TaskType::UI, "UiSessionRegisterWebPattern");
|
||||
};
|
||||
UiSessionManager::GetInstance().SaveRegisterForWebFunction(webCallback);
|
||||
return errorCode;
|
||||
}
|
||||
|
||||
|
@ -148,6 +148,27 @@ int32_t UIContentServiceProxy::RegisterComponentChangeEventCallback(const EventC
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
int32_t UIContentServiceProxy::RegisterWebUnfocusEventCallback(
|
||||
const std::function<void(int64_t accessibilityId, const std::string& data)>& eventCallback)
|
||||
{
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
MessageOption option;
|
||||
if (!data.WriteInterfaceToken(GetDescriptor())) {
|
||||
LOGW("RegisterWebUnfocusEventCallback write interface token failed");
|
||||
return FAILED;
|
||||
}
|
||||
if (report_ == nullptr) {
|
||||
LOGW("reportStub is nullptr,connect is not execute");
|
||||
}
|
||||
report_->RegisterWebUnfocusEventCallback(eventCallback);
|
||||
if (Remote()->SendRequest(REGISTER_WEB_UNFOCUS_EVENT, data, reply, option) != ERR_NONE) {
|
||||
LOGW("RegisterWebUnfocusEventCallback send request failed");
|
||||
return REPLY_ERROR;
|
||||
}
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
int32_t UIContentServiceProxy::UnregisterClickEventCallback()
|
||||
{
|
||||
MessageParcel data;
|
||||
@ -227,4 +248,24 @@ int32_t UIContentServiceProxy::UnregisterComponentChangeEventCallback()
|
||||
}
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
int32_t UIContentServiceProxy::UnregisterWebUnfocusEventCallback()
|
||||
{
|
||||
MessageParcel data;
|
||||
MessageParcel reply;
|
||||
MessageOption option;
|
||||
if (!data.WriteInterfaceToken(GetDescriptor())) {
|
||||
LOGW("UnregisterComponentChangeEventCallback write interface token failed");
|
||||
return FAILED;
|
||||
}
|
||||
if (report_ == nullptr) {
|
||||
LOGW("reportStub is nullptr,connect is not execute");
|
||||
}
|
||||
report_->UnregisterComponentChangeEventCallback();
|
||||
if (Remote()->SendRequest(UNREGISTER_COMPONENT_EVENT, data, reply, option) != ERR_NONE) {
|
||||
LOGW("UnregisterComponentChangeEventCallback send request failed");
|
||||
return REPLY_ERROR;
|
||||
}
|
||||
return NO_ERROR;
|
||||
}
|
||||
} // namespace OHOS::Ace
|
||||
|
@ -68,6 +68,10 @@ int32_t UiContentStub::OnRemoteRequest(uint32_t code, MessageParcel& data, Messa
|
||||
UnregisterComponentChangeEventCallbackInner(data, reply, option);
|
||||
break;
|
||||
}
|
||||
case UNREGISTER_WEB_UNFOCUS_EVENT: {
|
||||
UnregisterWebUnfocusEventCallbackInner(data, reply, option);
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
LOGI("ui_session unknown transaction code %{public}d", code);
|
||||
return IPCObjectStub::OnRemoteRequest(code, data, reply, option);
|
||||
@ -121,6 +125,13 @@ int32_t UiContentStub::RegisterComponentChangeEventCallbackInner(
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
int32_t UiContentStub::RegisterWebUnfocusEventCallbackInner(
|
||||
MessageParcel& data, MessageParcel& reply, MessageOption& option)
|
||||
{
|
||||
reply.WriteInt32(RegisterWebUnfocusEventCallback(nullptr));
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
int32_t UiContentStub::UnregisterClickEventCallbackInner(
|
||||
MessageParcel& data, MessageParcel& reply, MessageOption& option)
|
||||
{
|
||||
@ -148,4 +159,11 @@ int32_t UiContentStub::UnregisterComponentChangeEventCallbackInner(
|
||||
reply.WriteInt32(UnregisterComponentChangeEventCallback());
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
int32_t UiContentStub::UnregisterWebUnfocusEventCallbackInner(
|
||||
MessageParcel& data, MessageParcel& reply, MessageOption& option)
|
||||
{
|
||||
reply.WriteInt32(UnregisterWebUnfocusEventCallback());
|
||||
return NO_ERROR;
|
||||
}
|
||||
} // namespace OHOS::Ace
|
||||
|
@ -47,6 +47,14 @@ int32_t UIContentServiceStubImpl::RegisterComponentChangeEventCallback(const Eve
|
||||
UiSessionManager::GetInstance().SetComponentChangeEventRegistered(true);
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
int32_t UIContentServiceStubImpl::RegisterWebUnfocusEventCallback(
|
||||
const std::function<void(int64_t accessibilityId, const std::string& data)>& eventCallback)
|
||||
{
|
||||
UiSessionManager::GetInstance().NotifyAllWebPattern(true);
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
int32_t UIContentServiceStubImpl::UnregisterClickEventCallback()
|
||||
{
|
||||
UiSessionManager::GetInstance().SetClickEventRegistered(false);
|
||||
@ -67,4 +75,10 @@ int32_t UIContentServiceStubImpl::UnregisterComponentChangeEventCallback()
|
||||
UiSessionManager::GetInstance().SetComponentChangeEventRegistered(false);
|
||||
return NO_ERROR;
|
||||
}
|
||||
|
||||
int32_t UIContentServiceStubImpl::UnregisterWebUnfocusEventCallback()
|
||||
{
|
||||
UiSessionManager::GetInstance().NotifyAllWebPattern(false);
|
||||
return NO_ERROR;
|
||||
}
|
||||
} // namespace OHOS::Ace
|
||||
|
@ -120,4 +120,25 @@ void UiReportProxy::OnComponentChange(const std::string& key, const std::string&
|
||||
}
|
||||
}
|
||||
|
||||
void UiReportProxy::ReportWebUnfocusEvent(int64_t accessibilityId, const std::string& data)
|
||||
{
|
||||
MessageParcel messageData;
|
||||
MessageParcel reply;
|
||||
MessageOption option;
|
||||
if (!messageData.WriteInterfaceToken(GetDescriptor())) {
|
||||
LOGW("ReportWebUnfocusEvent write interface token failed");
|
||||
return;
|
||||
}
|
||||
if (!messageData.WriteString(data)) {
|
||||
LOGW("ReportWebUnfocusEvent write data failed");
|
||||
return;
|
||||
}
|
||||
if (!messageData.WriteInt64(accessibilityId)) {
|
||||
LOGW("ReportWebUnfocusEvent write data failed");
|
||||
return;
|
||||
}
|
||||
if (Remote()->SendRequest(REPORT_WEB_UNFOCUS_EVENT, messageData, reply, option) != ERR_NONE) {
|
||||
LOGW("ReportWebUnfocusEvent send request failed");
|
||||
}
|
||||
}
|
||||
} // namespace OHOS::Ace
|
||||
|
@ -46,6 +46,11 @@ int32_t UiReportStub::OnRemoteRequest(uint32_t code, MessageParcel& data, Messag
|
||||
ReportInspectorTreeValue(result);
|
||||
break;
|
||||
}
|
||||
case REPORT_WEB_UNFOCUS_EVENT: {
|
||||
int64_t accessibilityId = data.ReadInt64();
|
||||
ReportWebUnfocusEvent(accessibilityId, result);
|
||||
break;
|
||||
}
|
||||
default: {
|
||||
LOGI("ui_session unknown transaction code %{public}d", code);
|
||||
return IPCObjectStub::OnRemoteRequest(code, data, reply, option);
|
||||
@ -89,6 +94,13 @@ void UiReportStub::ReportInspectorTreeValue(const std::string& data)
|
||||
}
|
||||
}
|
||||
|
||||
void UiReportStub::ReportWebUnfocusEvent(int64_t accessibilityId, const std::string& data)
|
||||
{
|
||||
if (unfocusEvent_ != nullptr) {
|
||||
unfocusEvent_(accessibilityId, data);
|
||||
}
|
||||
}
|
||||
|
||||
void UiReportStub::RegisterClickEventCallback(const EventCallback& eventCallback)
|
||||
{
|
||||
clickEventCallback_ = std::move(eventCallback);
|
||||
@ -113,6 +125,13 @@ void UiReportStub::RegisterComponentChangeEventCallback(const EventCallback& eve
|
||||
{
|
||||
ComponentChangeEventCallback_ = std::move(eventCallback);
|
||||
}
|
||||
|
||||
void UiReportStub::RegisterWebUnfocusEventCallback(
|
||||
const std::function<void(int64_t accessibilityId, const std::string& data)>& eventCallback)
|
||||
{
|
||||
unfocusEvent_ = std::move(eventCallback);
|
||||
}
|
||||
|
||||
void UiReportStub::UnregisterClickEventCallback()
|
||||
{
|
||||
clickEventCallback_ = nullptr;
|
||||
|
@ -75,6 +75,18 @@ void UiSessionManager::ReportComponentChangeEvent(const std::string& key, const
|
||||
}
|
||||
}
|
||||
|
||||
void UiSessionManager::ReportWebUnfocusEvent(int64_t accessibilityId, const std::string& data)
|
||||
{
|
||||
for (auto pair : reportObjectMap_) {
|
||||
auto reportService = iface_cast<ReportService>(pair.second);
|
||||
if (reportService != nullptr) {
|
||||
reportService->ReportWebUnfocusEvent(accessibilityId, data);
|
||||
} else {
|
||||
LOGW("report web unfocus event failed,process id:%{public}d", pair.first);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void UiSessionManager::SaveReportStub(sptr<IRemoteObject> reportStub, int32_t processId)
|
||||
{
|
||||
reportObjectMap_.emplace(processId, reportStub);
|
||||
@ -184,6 +196,22 @@ void UiSessionManager::ReportInspectorTreeValue(const std::string& data)
|
||||
}
|
||||
}
|
||||
|
||||
void UiSessionManager::NotifyAllWebPattern(bool isRegister)
|
||||
{
|
||||
webFocusEventRegistered = isRegister;
|
||||
notifyWebFunction_(isRegister);
|
||||
}
|
||||
|
||||
void UiSessionManager::SaveRegisterForWebFunction(NotifyAllWebFunction&& function)
|
||||
{
|
||||
notifyWebFunction_ = std::move(function);
|
||||
}
|
||||
|
||||
bool UiSessionManager::GetWebFocusRegistered()
|
||||
{
|
||||
return webFocusEventRegistered;
|
||||
}
|
||||
|
||||
void UiSessionManager::OnRouterChange(const std::string& path, const std::string& event)
|
||||
{
|
||||
if (GetRouterChangeEventRegistered()) {
|
||||
|
@ -4721,4 +4721,23 @@ void FrameNode::ProcessFrameNodeChangeFlag()
|
||||
pattern->OnFrameNodeChanged(changeFlag);
|
||||
}
|
||||
}
|
||||
|
||||
void FrameNode::NotifyWebPattern(bool isRegister)
|
||||
{
|
||||
#if !defined(PREVIEW) && !defined(ACE_UNITTEST) && defined(WEB_SUPPORTED)
|
||||
if (GetTag() == V2::WEB_ETS_TAG) {
|
||||
auto pattern = GetPattern<NG::WebPattern>();
|
||||
CHECK_NULL_VOID(pattern);
|
||||
if (isRegister) {
|
||||
auto callback = [](int64_t accessibilityId, const std::string data) {
|
||||
UiSessionManager::GetInstance().ReportWebUnfocusEvent(accessibilityId, data);
|
||||
};
|
||||
pattern->RegisterTextBlurCallback(callback);
|
||||
} else {
|
||||
pattern->UnRegisterTextBlurCallback();
|
||||
}
|
||||
}
|
||||
#endif
|
||||
UINode::NotifyWebPattern(isRegister);
|
||||
}
|
||||
} // namespace OHOS::Ace::NG
|
||||
|
@ -934,6 +934,7 @@ public:
|
||||
ChildrenListWithGuard GetAllChildren();
|
||||
OPINC_TYPE_E FindSuggestOpIncNode(std::string& path, const SizeF& boundary, int32_t depth);
|
||||
void GetInspectorValue() override;
|
||||
void NotifyWebPattern(bool isRegister) override;
|
||||
|
||||
FrameNodeChangeInfoFlag GetChangeInfoFlag()
|
||||
{
|
||||
|
@ -1448,4 +1448,11 @@ void UINode::GetInspectorValue()
|
||||
item->GetInspectorValue();
|
||||
}
|
||||
}
|
||||
|
||||
void UINode::NotifyWebPattern(bool isRegister)
|
||||
{
|
||||
for (const auto& item : GetChildren()) {
|
||||
item->NotifyWebPattern(isRegister);
|
||||
}
|
||||
}
|
||||
} // namespace OHOS::Ace::NG
|
||||
|
@ -713,6 +713,7 @@ public:
|
||||
}
|
||||
|
||||
virtual void GetInspectorValue();
|
||||
virtual void NotifyWebPattern(bool isRegister);
|
||||
|
||||
protected:
|
||||
std::list<RefPtr<UINode>>& ModifyChildren()
|
||||
@ -775,7 +776,6 @@ protected:
|
||||
virtual void PaintDebugBoundary(bool flag) {}
|
||||
|
||||
PipelineContext* context_ = nullptr;
|
||||
|
||||
private:
|
||||
void DoAddChild(std::list<RefPtr<UINode>>::iterator& it, const RefPtr<UINode>& child, bool silently = false,
|
||||
bool addDefaultTransition = false);
|
||||
|
@ -24,6 +24,9 @@
|
||||
#include "input_method_controller.h"
|
||||
#include "parameters.h"
|
||||
|
||||
#if !defined(PREVIEW) && !defined(ACE_UNITTEST)
|
||||
#include "interfaces/inner_api/ui_session/ui_session_manager.h"
|
||||
#endif
|
||||
#include "base/geometry/ng/offset_t.h"
|
||||
#include "base/image/file_uri_helper.h"
|
||||
#include "base/mousestyle/mouse_style.h"
|
||||
@ -320,6 +323,14 @@ void WebPattern::OnAttachToFrameNode()
|
||||
}
|
||||
});
|
||||
UpdateTransformHintChangedCallbackId(callbackId);
|
||||
#if !defined(PREVIEW) && !defined(ACE_UNITTEST)
|
||||
if (UiSessionManager::GetInstance().GetWebFocusRegistered()) {
|
||||
auto callback = [](int64_t accessibilityId, const std::string data) {
|
||||
UiSessionManager::GetInstance().ReportWebUnfocusEvent(accessibilityId, data);
|
||||
};
|
||||
RegisterTextBlurCallback(callback);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void WebPattern::OnDetachFromFrameNode(FrameNode* frameNode)
|
||||
@ -339,6 +350,11 @@ void WebPattern::OnDetachFromFrameNode(FrameNode* frameNode)
|
||||
if (HasTransformHintChangedCallbackId()) {
|
||||
pipeline->UnregisterTransformHintChangedCallback(transformHintChangedCallbackId_.value_or(-1));
|
||||
}
|
||||
#if !defined(PREVIEW) && !defined(ACE_UNITTEST)
|
||||
if (UiSessionManager::GetInstance().GetWebFocusRegistered()) {
|
||||
UnRegisterTextBlurCallback();
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void WebPattern::SetRotation(uint32_t rotation)
|
||||
|
@ -3973,4 +3973,9 @@ void PipelineContext::CleanNodeChangeFlag()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void PipelineContext::NotifyAllWebPattern(bool isRegister)
|
||||
{
|
||||
rootNode_->NotifyWebPattern(isRegister);
|
||||
}
|
||||
} // namespace OHOS::Ace::NG
|
||||
|
@ -803,7 +803,7 @@ public:
|
||||
lastVsyncEndTimestamp_ = lastVsyncEndTimestamp;
|
||||
}
|
||||
void GetInspectorTree();
|
||||
|
||||
void NotifyAllWebPattern(bool isRegister);
|
||||
void AddFrameNodeChangeListener(const RefPtr<FrameNode>& node);
|
||||
void RemoveFrameNodeChangeListener(const RefPtr<FrameNode>& node);
|
||||
void AddChangedFrameNode(const RefPtr<FrameNode>& node);
|
||||
|
@ -31,10 +31,13 @@ public:
|
||||
virtual int32_t RegisterRouterChangeEventCallback(const EventCallback& eventCallback) override;
|
||||
virtual int32_t RegisterSearchEventCallback(const EventCallback& eventCallback) override;
|
||||
virtual int32_t RegisterComponentChangeEventCallback(const EventCallback& eventCallback) override;
|
||||
virtual int32_t RegisterWebUnfocusEventCallback(
|
||||
const std::function<void(int64_t accessibilityId, const std::string& data)>& eventCallback) override;
|
||||
virtual int32_t UnregisterClickEventCallback() override;
|
||||
virtual int32_t UnregisterSearchEventCallback() override;
|
||||
virtual int32_t UnregisterRouterChangeEventCallback() override;
|
||||
virtual int32_t UnregisterComponentChangeEventCallback() override;
|
||||
virtual int32_t UnregisterWebUnfocusEventCallback() override;
|
||||
|
||||
private:
|
||||
static inline BrokerDelegator<UIContentServiceProxy> delegator_;
|
||||
|
@ -33,11 +33,12 @@ public:
|
||||
REGISTER_SEARCH_EVENT,
|
||||
REGISTER_ROUTER_CHANGE_EVENT,
|
||||
REGISTER_COMPONENT_EVENT,
|
||||
REGISTER_WEB_UNFOCUS_EVENT,
|
||||
UNREGISTER_CLICK_EVENT,
|
||||
UNREGISTER_SEARCH_EVENT,
|
||||
UNREGISTER_ROUTER_CHANGE_EVENT,
|
||||
UNREGISTER_COMPONENT_EVENT,
|
||||
|
||||
UNREGISTER_WEB_UNFOCUS_EVENT,
|
||||
};
|
||||
|
||||
/**
|
||||
@ -76,6 +77,13 @@ public:
|
||||
*/
|
||||
virtual int32_t RegisterComponentChangeEventCallback(const EventCallback& eventCallback) = 0;
|
||||
|
||||
/**
|
||||
* @description: define register a callback on web unfocus event occur to execute interface
|
||||
* @return: result number
|
||||
*/
|
||||
virtual int32_t RegisterWebUnfocusEventCallback(
|
||||
const std::function<void(int64_t accessibilityId, const std::string& data)>& eventCallback) = 0;
|
||||
|
||||
/**
|
||||
* @description: define unregister the click event occur callback last register interface
|
||||
* @return: result number
|
||||
@ -99,6 +107,12 @@ public:
|
||||
* @return: result number
|
||||
*/
|
||||
virtual int32_t UnregisterComponentChangeEventCallback() = 0;
|
||||
|
||||
/**
|
||||
* @description: define unregister the web focus event occur callback last register interface
|
||||
* @return: result number
|
||||
*/
|
||||
virtual int32_t UnregisterWebUnfocusEventCallback() = 0;
|
||||
};
|
||||
class ACE_FORCE_EXPORT ReportService : public OHOS::IRemoteBroker {
|
||||
public:
|
||||
@ -111,7 +125,8 @@ public:
|
||||
REPORT_SWITCH_EVENT,
|
||||
REPORT_COMPONENT_EVENT,
|
||||
REPORT_SEARCH_EVENT,
|
||||
REPORT_INSPECTOR_VALUE
|
||||
REPORT_INSPECTOR_VALUE,
|
||||
REPORT_WEB_UNFOCUS_EVENT
|
||||
};
|
||||
|
||||
/**
|
||||
@ -138,6 +153,11 @@ public:
|
||||
* @description: define reports inspector value to the proxy interface
|
||||
*/
|
||||
virtual void ReportInspectorTreeValue(const std::string& data) = 0;
|
||||
|
||||
/**
|
||||
* @description: define reports web unfocus value to the proxy interface
|
||||
*/
|
||||
virtual void ReportWebUnfocusEvent(int64_t accessibilityId, const std::string& data) = 0;
|
||||
};
|
||||
} // namespace OHOS::Ace
|
||||
#endif // FOUNDATION_ACE_INTERFACE_UI_CONTENT_SERVICE_INTERFACE_H
|
||||
|
@ -34,11 +34,13 @@ private:
|
||||
int32_t RegisterRouterChangeEventCallbackInner(MessageParcel& data, MessageParcel& reply, MessageOption& option);
|
||||
int32_t RegisterSearchEventCallbackInner(MessageParcel& data, MessageParcel& reply, MessageOption& option);
|
||||
int32_t RegisterComponentChangeEventCallbackInner(MessageParcel& data, MessageParcel& reply, MessageOption& option);
|
||||
int32_t RegisterWebUnfocusEventCallbackInner(MessageParcel& data, MessageParcel& reply, MessageOption& option);
|
||||
int32_t UnregisterClickEventCallbackInner(MessageParcel& data, MessageParcel& reply, MessageOption& option);
|
||||
int32_t UnregisterSearchEventCallbackInner(MessageParcel& data, MessageParcel& reply, MessageOption& option);
|
||||
int32_t UnregisterRouterChangeEventCallbackInner(MessageParcel& data, MessageParcel& reply, MessageOption& option);
|
||||
int32_t UnregisterComponentChangeEventCallbackInner(
|
||||
MessageParcel& data, MessageParcel& reply, MessageOption& option);
|
||||
int32_t UnregisterWebUnfocusEventCallbackInner(MessageParcel& data, MessageParcel& reply, MessageOption& option);
|
||||
};
|
||||
} // namespace OHOS::Ace
|
||||
#endif // FOUNDATION_ACE_INTERFACE_UI_CONTENT_STUB_H
|
||||
|
@ -36,11 +36,13 @@ public:
|
||||
int32_t RegisterRouterChangeEventCallback(const EventCallback& eventCallback) override;
|
||||
int32_t RegisterSearchEventCallback(const EventCallback& eventCallback) override;
|
||||
int32_t RegisterComponentChangeEventCallback(const EventCallback& eventCallback) override;
|
||||
int32_t RegisterWebUnfocusEventCallback(
|
||||
const std::function<void(int64_t accessibilityId, const std::string& data)>& eventCallback) override;
|
||||
int32_t UnregisterClickEventCallback() override;
|
||||
int32_t UnregisterSearchEventCallback() override;
|
||||
int32_t UnregisterRouterChangeEventCallback() override;
|
||||
int32_t UnregisterComponentChangeEventCallback() override;
|
||||
int32_t UnregisterWebUnfocusEventCallback() override;
|
||||
};
|
||||
} // namespace OHOS::Ace
|
||||
#endif // FOUNDATION_ACE_INTERFACE_UI_CONTENT_STUB_IMPL_H
|
||||
|
||||
|
@ -52,6 +52,10 @@ public:
|
||||
*/
|
||||
void ReportInspectorTreeValue(const std::string& data) override;
|
||||
|
||||
/**
|
||||
* @description: notify stub side to report web unfocus value
|
||||
*/
|
||||
void ReportWebUnfocusEvent(int64_t accessibilityId, const std::string& data) override;
|
||||
void OnComponentChange(const std::string& key, const std::string& value);
|
||||
|
||||
private:
|
||||
|
@ -79,6 +79,13 @@ public:
|
||||
*/
|
||||
void RegisterGetInspectorTreeCallback(const EventCallback& eventCallback);
|
||||
|
||||
/**
|
||||
* @description: register a callback when get inspector tree
|
||||
* @param eventCallback callback to be performed
|
||||
*/
|
||||
void RegisterWebUnfocusEventCallback(
|
||||
const std::function<void(int64_t accessibilityId, const std::string& data)>& eventCallback);
|
||||
|
||||
/**
|
||||
* @description: unregister the click callback last register
|
||||
*/
|
||||
@ -104,12 +111,18 @@ public:
|
||||
*/
|
||||
void ReportInspectorTreeValue(const std::string& data) override;
|
||||
|
||||
/**
|
||||
* @description: report web unfocus value for SA
|
||||
*/
|
||||
void ReportWebUnfocusEvent(int64_t accessibilityId, const std::string& data) override;
|
||||
|
||||
private:
|
||||
EventCallback clickEventCallback_;
|
||||
EventCallback searchEventCallback_;
|
||||
EventCallback RouterChangeEventCallback_;
|
||||
EventCallback ComponentChangeEventCallback_;
|
||||
EventCallback inspectorTreeCallback_;
|
||||
std::function<void(int64_t accessibilityId, const std::string& data)> unfocusEvent_;
|
||||
};
|
||||
} // namespace OHOS::Ace
|
||||
#endif // FOUNDATION_ACE_INTERFACE_UI_REPORT_STUB_H
|
||||
|
@ -28,7 +28,7 @@ namespace OHOS::Ace {
|
||||
class ACE_FORCE_EXPORT UiSessionManager {
|
||||
public:
|
||||
using InspectorFunction = std::function<void()>;
|
||||
|
||||
using NotifyAllWebFunction = std::function<void(bool isRegister)>;
|
||||
/**
|
||||
* @description: Get ui_manager instance,this object process singleton
|
||||
* @return The return value is ui_manager singleton
|
||||
@ -69,6 +69,9 @@ public:
|
||||
void WebTaskNumsChange(int32_t num);
|
||||
void ReportInspectorTreeValue(const std::string& value);
|
||||
void SaveInspectorTreeFunction(InspectorFunction&& function);
|
||||
void SaveRegisterForWebFunction(NotifyAllWebFunction&& function);
|
||||
void ReportWebUnfocusEvent(int64_t accessibilityId, const std::string& data);
|
||||
void NotifyAllWebPattern(bool isRegister);
|
||||
void SetClickEventRegistered(bool status);
|
||||
void SetSearchEventRegistered(bool status);
|
||||
void OnRouterChange(const std::string& path, const std::string& event);
|
||||
@ -78,7 +81,7 @@ public:
|
||||
bool GetSearchEventRegistered();
|
||||
bool GetRouterChangeEventRegistered();
|
||||
bool GetComponentChangeEventRegistered();
|
||||
|
||||
bool GetWebFocusRegistered();
|
||||
private:
|
||||
static std::mutex mutex_;
|
||||
std::map<int32_t, sptr<IRemoteObject>> reportObjectMap_;
|
||||
@ -86,7 +89,9 @@ private:
|
||||
int32_t searchEventRegisterProcesses_ = 0;
|
||||
int32_t routerChangeEventRegisterProcesses_ = 0;
|
||||
int32_t componentChangeEventRegisterProcesses_ = 0;
|
||||
bool webFocusEventRegistered = false;
|
||||
InspectorFunction inspectorFunction_ = 0;
|
||||
NotifyAllWebFunction notifyWebFunction_ = 0;
|
||||
std::shared_ptr<InspectorJsonValue> jsonValue_ = nullptr;
|
||||
int32_t webTaskNums = 0;
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user