1 Star 0 Fork 39

libing23/security_security_component

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
src.patch 6.14 KB
一键复制 编辑 原始数据 按行查看 历史
libing23 提交于 2024-06-19 16:23 +08:00 . upload patch
diff --git a/components/security_interstitials_strings.grdp b/components/security_interstitials_strings.grdp
index d39c74f17..f6788481c 100644
--- a/components/security_interstitials_strings.grdp
+++ b/components/security_interstitials_strings.grdp
@@ -554,6 +554,9 @@
<message name="IDS_OHOS_BLOCK_PAGE_FRAUD_INFO_TITLE" use_name_for_id="true" desc="The title of the block page shown when the requested URL is unavaiable">
Beware of online fraud.
</message>
+ <message name="IDS_OHOS_BLOCK_PAGE_URL_TRUST_LIST_TITILE" use_name_for_id="true" desc="The title of the block page shown when the requested URL is restricted">
+ This page is restricted from access.
+ </message>
<message name="IDS_OHOS_BLOCK_PAGE_ILLEGAL_INFO_BODY" use_name_for_id="true" desc="Message informing the user this website is illegal and cann't access it">
According the laws and regulations and complaints, this page contains illegal or illegal content and has been stopped.
</message>
diff --git a/components/strings/components_strings_en-GB.xtb b/components/strings/components_strings_en-GB.xtb
index 00b1ada03..4568fbc44 100644
--- a/components/strings/components_strings_en-GB.xtb
+++ b/components/strings/components_strings_en-GB.xtb
@@ -3401,6 +3401,7 @@ Additional details:
<translation id="IDS_OHOS_BLOCK_PAGE_TITLE">Warning</translation>
<translation id="IDS_OHOS_BLOCK_PAGE_INFO_TITLE">This page cannot be accessed.</translation>
<translation id="IDS_OHOS_BLOCK_PAGE_FRAUD_INFO_TITLE">Beware of online fraud.</translation>
+<translation id="IDS_OHOS_BLOCK_PAGE_URL_TRUST_LIST_TITILE">This page is restricted from access.</translation>
<translation id="IDS_OHOS_BLOCK_PAGE_ILLEGAL_INFO_BODY">
According the laws and regulations and complaints, this page contains illegal or illegal content and has been stopped.
</translation>
diff --git a/components/strings/components_strings_zh-CN.xtb b/components/strings/components_strings_zh-CN.xtb
index 3f33f742c..a9928f09d 100644
--- a/components/strings/components_strings_zh-CN.xtb
+++ b/components/strings/components_strings_zh-CN.xtb
@@ -3397,6 +3397,7 @@
<translation id="IDS_OHOS_BLOCK_PAGE_TITLE">风险提示</translation>
<translation id="IDS_OHOS_BLOCK_PAGE_INFO_TITLE">已停止访问此网页</translation>
<translation id="IDS_OHOS_BLOCK_PAGE_FRAUD_INFO_TITLE">谨防网络诈骗</translation>
+<translation id="IDS_OHOS_BLOCK_PAGE_URL_TRUST_LIST_TITILE">此网页被限制访问</translation>
<translation id="IDS_OHOS_BLOCK_PAGE_ILLEGAL_INFO_BODY">根据法律法规要求以及投诉举报,此网页包含违法或违规内容,已停止访问。</translation>
<translation id="IDS_OHOS_BLOCK_PAGE_FRAUD_INFO_BODY">您访问的网页存在诈骗风险,请您注意个人信息和财产安全。</translation>
<translation id="IDS_OHOS_BLOCK_PAGE_RISK_INFO_BODY">您访问的网页存在安全风险,请您注意个人信息和财产安全。</translation>
diff --git a/ohos_nweb/src/cef_delegate/nweb_delegate.cc b/ohos_nweb/src/cef_delegate/nweb_delegate.cc
index 295729bf0..6bb937163 100644
--- a/ohos_nweb/src/cef_delegate/nweb_delegate.cc
+++ b/ohos_nweb/src/cef_delegate/nweb_delegate.cc
@@ -3573,13 +3573,16 @@ void NWebDelegate::OnTextSelected() {
#endif
#if OHOS_URL_TRUST_LIST
-int NWebDelegate::SetUrlTrustList(const std::string& urlTrustList) {
+int NWebDelegate::SetUrlTrustList(const std::string& urlTrustList, std::string& detailErrMsg) {
LOG(INFO) << "NWebDelegate::SetUrlTrustList";
if (!GetBrowser().get()) {
LOG(ERROR) << "NWebDelegate::SetUrlTrustList failed, get browser failed";
return static_cast<int>(ohos_safe_browsing::UrlListSetResult::INIT_ERROR);
}
- return GetBrowser()->SetUrlTrustList(urlTrustList);
+ CefString detailErrMsgCef;
+ int res = GetBrowser()->SetUrlTrustList(urlTrustList, detailErrMsgCef);
+ detailErrMsg = detailErrMsgCef.ToString();
+ return res;
}
#endif
diff --git a/ohos_nweb/src/cef_delegate/nweb_delegate.h b/ohos_nweb/src/cef_delegate/nweb_delegate.h
index 5c7d87247..4fe2d02e7 100644
--- a/ohos_nweb/src/cef_delegate/nweb_delegate.h
+++ b/ohos_nweb/src/cef_delegate/nweb_delegate.h
@@ -481,7 +481,7 @@ void NotifyForNextTouchEvent() override;
#endif
#ifdef OHOS_URL_TRUST_LIST
- int SetUrlTrustList(const std::string& urlTrustList) override;
+ int SetUrlTrustList(const std::string& urlTrustList, std::string& detailErrMsg) override;
#endif
#ifdef OHOS_NETWORK_LOAD
diff --git a/ohos_nweb/src/nweb_delegate_interface.h b/ohos_nweb/src/nweb_delegate_interface.h
index 8fcae13f3..a57630681 100644
--- a/ohos_nweb/src/nweb_delegate_interface.h
+++ b/ohos_nweb/src/nweb_delegate_interface.h
@@ -489,7 +489,7 @@ class NWebDelegateInterface
#endif
#if OHOS_URL_TRUST_LIST
- virtual int SetUrlTrustList(const std::string& urlTrustList) = 0;
+ virtual int SetUrlTrustList(const std::string& urlTrustList, std::string& detailErrMsg) = 0;
#endif
#ifdef OHOS_NETWORK_LOAD
diff --git a/ohos_nweb/src/nweb_impl.cc b/ohos_nweb/src/nweb_impl.cc
index 4a0699a81..f3979b995 100644
--- a/ohos_nweb/src/nweb_impl.cc
+++ b/ohos_nweb/src/nweb_impl.cc
@@ -3211,13 +3211,14 @@ void NWebImpl::SetPathAllowingUniversalAccess(
nweb_delegate_->SetPathAllowingUniversalAccess(pathList);
}
#endif
-int NWebImpl::SetUrlTrustList(const std::string& urlTrustList) {
+
+int NWebImpl::SetUrlTrustList(const std::string& urlTrustList, std::string& detailErrMsg) {
#if OHOS_URL_TRUST_LIST
if (nweb_delegate_ == nullptr) {
return static_cast<int>(ohos_safe_browsing::UrlListSetResult::INIT_ERROR);
}
- return nweb_delegate_->SetUrlTrustList(urlTrustList);
+ return nweb_delegate_->SetUrlTrustList(urlTrustList, detailErrMsg);
#else
return -1;
#endif
diff --git a/ohos_nweb/src/nweb_impl.h b/ohos_nweb/src/nweb_impl.h
index 15dda7d93..b925b4679 100644
--- a/ohos_nweb/src/nweb_impl.h
+++ b/ohos_nweb/src/nweb_impl.h
@@ -498,7 +498,7 @@ class NWebImpl : public NWeb {
int height,
const WebSnapshotCallback callback) override;
#endif
- int SetUrlTrustList(const std::string& urlTrustList) override;
+ int SetUrlTrustList(const std::string& urlTrustList, std::string& detailErrMsg) override;
#ifdef OHOS_NETWORK_LOAD
void SetPathAllowingUniversalAccess(
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
1
https://gitee.com/libing23/security_security_component.git
git@gitee.com:libing23/security_security_component.git
libing23
security_security_component
security_security_component
master

搜索帮助