Commit bd4ea4ad authored by edchin's avatar edchin Committed by Chromium LUCI CQ

[ios][PhishGuard] Extract SetReferringAppInfo

This CL makes it easier/clearer to split up PasswordProtectionRequest
in a future CL.

Android-only code that depends on WebContents is extracted to a
standalone method - SetReferringAppInfo.
The content derived class implementation of
PasswordProtectionRequest will have access to WebContents and the
method will be moved there in a future CL.

Bug: 1147967
Change-Id: Ic38c933cb8d633bbef77c7b36460aa140bc55a87
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2637403
Commit-Queue: edchin <edchin@chromium.org>
Reviewed-by: default avatarBettina Dea <bdea@chromium.org>
Reviewed-by: default avatarAli Juma <ajuma@chromium.org>
Cr-Commit-Position: refs/heads/master@{#845492}
parent f0fe9173
......@@ -278,18 +278,7 @@ void PasswordProtectionRequest::FillRequestProto(bool is_sampled_ping) {
#endif // BUILDFLAG(FULL_SAFE_BROWSING)
#if defined(OS_ANDROID)
if (base::FeatureList::IsEnabled(
safe_browsing::kPasswordProtectionReferringAppEnabledAndroid)) {
LoginReputationClientRequest::ReferringAppInfo referring_app_info =
password_protection_service_->GetReferringAppInfo(web_contents_);
UMA_HISTOGRAM_ENUMERATION(
"PasswordProtection.RequestReferringAppSource",
referring_app_info.referring_app_source(),
LoginReputationClientRequest::ReferringAppInfo::ReferringAppSource_MAX +
1);
*request_proto_->mutable_referring_app_info() =
std::move(referring_app_info);
}
SetReferringAppInfo();
#endif // defined(OS_ANDROID)
switch (trigger_type_) {
......@@ -650,4 +639,17 @@ void PasswordProtectionRequest::HandleDeferredNavigations() {
throttles_.clear();
}
#if defined(OS_ANDROID)
void PasswordProtectionRequest::SetReferringAppInfo() {
LoginReputationClientRequest::ReferringAppInfo referring_app_info =
password_protection_service_->GetReferringAppInfo(web_contents_);
UMA_HISTOGRAM_ENUMERATION(
"PasswordProtection.RequestReferringAppSource",
referring_app_info.referring_app_source(),
LoginReputationClientRequest::ReferringAppInfo::ReferringAppSource_MAX +
1);
*request_proto_->mutable_referring_app_info() = std::move(referring_app_info);
}
#endif // defined(OS_ANDROID)
} // namespace safe_browsing
......@@ -224,6 +224,11 @@ class PasswordProtectionRequest
std::unique_ptr<VisualFeatures> visual_features);
#endif // BUILDFLAG(FULL_SAFE_BROWSING)
#if defined(OS_ANDROID)
// Sets the referring app info.
void SetReferringAppInfo();
#endif // defined(OS_ANDROID)
// Initiates network request to Safe Browsing backend.
void SendRequest();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment