Commit 515ab3c4 authored by Findit's avatar Findit

Revert "[AF] Add CTR and save rate metrics split out by security level."

This reverts commit 52104cbd.

Reason for revert:

Findit (https://goo.gl/kROfz5) identified CL at revision 569136 as the
culprit for failures in the build cycles as shown on:
https://findit-for-me.appspot.com/waterfall/culprit?key=ag9zfmZpbmRpdC1mb3ItbWVyRAsSDVdmU3VzcGVjdGVkQ0wiMWNocm9taXVtLzUyMTA0Y2JkYmE3OGYwMDUwMzU5MjQxNDRhYWIyMDFkY2U2MTViMTUM

Sample Failed Build: https://ci.chromium.org/buildbot/chromium.memory/Linux%20MSan%20Tests/10528

Sample Failed Step: components_unittests

Original change's description:
> [AF] Add CTR and save rate metrics split out by security level.
> 
> This Cl adds autofill metrics based on the security level. The
> goal is to see whether the security level impacts the CTR of
> autofill suggestions or the card save rate.
> 
> Bug: 853347
> Cq-Include-Trybots: luci.chromium.try:ios-simulator-full-configs;master.tryserver.chromium.mac:ios-simulator-cronet
> Change-Id: I75ce8c6b924d7fd90e80e518af46509bb6bccde2
> Reviewed-on: https://chromium-review.googlesource.com/1103218
> Commit-Queue: Sebastien Seguin-Gagnon <sebsg@chromium.org>
> Reviewed-by: Eugene But <eugenebut@chromium.org>
> Reviewed-by: Christopher Thompson <cthomp@chromium.org>
> Reviewed-by: Tao Bai <michaelbai@chromium.org>
> Reviewed-by: Mathieu Perreault <mathp@chromium.org>
> Reviewed-by: Moe Ahmadi <mahmadi@chromium.org>
> Cr-Commit-Position: refs/heads/master@{#569136}

Change-Id: I16e9c57d18fbb81e37742bee5269816e7be377a5
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: 853347
Cq-Include-Trybots: luci.chromium.try:ios-simulator-full-configs;master.tryserver.chromium.mac:ios-simulator-cronet
Reviewed-on: https://chromium-review.googlesource.com/1109618
Cr-Commit-Position: refs/heads/master@{#569184}
parent d050260a
......@@ -91,13 +91,6 @@ autofill::AddressNormalizer* AwAutofillClient::GetAddressNormalizer() {
return nullptr;
}
security_state::SecurityLevel
AwAutofillClient::GetSecurityLevelForUmaHistograms() {
// The metrics are not recorded for Android webview, so return the count value
// which will not be recorded.
return security_state::SecurityLevel::SECURITY_LEVEL_COUNT;
}
autofill::PersonalDataManager* AwAutofillClient::GetPersonalDataManager() {
return nullptr;
}
......
......@@ -67,7 +67,6 @@ class AwAutofillClient : public autofill::AutofillClient,
ukm::UkmRecorder* GetUkmRecorder() override;
ukm::SourceId GetUkmSourceId() override;
autofill::AddressNormalizer* GetAddressNormalizer() override;
security_state::SecurityLevel GetSecurityLevelForUmaHistograms() override;
void ShowAutofillSettings() override;
void ShowUnmaskPrompt(
const autofill::CreditCard& card,
......
......@@ -20,7 +20,6 @@
#include "chrome/browser/signin/identity_manager_factory.h"
#include "chrome/browser/signin/signin_promo_util.h"
#include "chrome/browser/ssl/insecure_sensitive_input_driver_factory.h"
#include "chrome/browser/ssl/security_state_tab_helper.h"
#include "chrome/browser/sync/profile_sync_service_factory.h"
#include "chrome/browser/ui/autofill/autofill_popup_controller_impl.h"
#include "chrome/browser/ui/autofill/create_card_unmask_prompt_view.h"
......@@ -150,22 +149,6 @@ AddressNormalizer* ChromeAutofillClient::GetAddressNormalizer() {
return nullptr;
}
security_state::SecurityLevel
ChromeAutofillClient::GetSecurityLevelForUmaHistograms() {
SecurityStateTabHelper* helper =
::SecurityStateTabHelper::FromWebContents(web_contents());
// If there is no helper, it means we are not in a "web" state (for example
// the file picker on CrOS). Return SECURITY_LEVEL_COUNT which will not be
// logged.
if (!helper)
return security_state::SecurityLevel::SECURITY_LEVEL_COUNT;
security_state::SecurityInfo security_info;
helper->GetSecurityInfo(&security_info);
return security_info.security_level;
}
void ChromeAutofillClient::ShowAutofillSettings() {
#if defined(OS_ANDROID)
chrome::android::PreferencesLauncher::ShowAutofillSettings(web_contents());
......
......@@ -55,7 +55,6 @@ class ChromeAutofillClient
ukm::UkmRecorder* GetUkmRecorder() override;
ukm::SourceId GetUkmSourceId() override;
AddressNormalizer* GetAddressNormalizer() override;
security_state::SecurityLevel GetSecurityLevelForUmaHistograms() override;
void ShowAutofillSettings() override;
void ShowUnmaskPrompt(const CreditCard& card,
UnmaskCardReason reason,
......
......@@ -9,7 +9,6 @@
#include "chrome/browser/profiles/profile.h"
#include "chrome/browser/signin/account_tracker_service_factory.h"
#include "chrome/browser/signin/signin_manager_factory.h"
#include "chrome/browser/ssl/security_state_tab_helper.h"
#include "chrome/browser/ui/autofill/save_card_bubble_view.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_finder.h"
......@@ -45,12 +44,7 @@ SaveCardBubbleControllerImpl::SaveCardBubbleControllerImpl(
web_contents_(web_contents),
save_card_bubble_view_(nullptr),
pref_service_(
user_prefs::UserPrefs::Get(web_contents->GetBrowserContext())) {
security_state::SecurityInfo security_info;
SecurityStateTabHelper::FromWebContents(web_contents)
->GetSecurityInfo(&security_info);
security_level_ = security_info.security_level;
}
user_prefs::UserPrefs::Get(web_contents->GetBrowserContext())) {}
SaveCardBubbleControllerImpl::~SaveCardBubbleControllerImpl() {
if (save_card_bubble_view_)
......@@ -73,8 +67,7 @@ void SaveCardBubbleControllerImpl::ShowBubbleForLocalSave(
AutofillMetrics::SAVE_CARD_PROMPT_SHOW_REQUESTED, is_uploading_,
is_reshow_,
pref_service_->GetInteger(
prefs::kAutofillAcceptSaveCreditCardPromptState),
GetSecurityLevel());
prefs::kAutofillAcceptSaveCreditCardPromptState));
card_ = card;
local_save_card_callback_ = save_card_callback;
......@@ -101,8 +94,7 @@ void SaveCardBubbleControllerImpl::ShowBubbleForUpload(
AutofillMetrics::SAVE_CARD_PROMPT_SHOW_REQUESTED, is_uploading_,
is_reshow_,
pref_service_->GetInteger(
prefs::kAutofillAcceptSaveCreditCardPromptState),
GetSecurityLevel());
prefs::kAutofillAcceptSaveCreditCardPromptState));
if (!LegalMessageLine::Parse(*legal_message, &legal_message_lines_,
/*escape_apostrophes=*/true)) {
......@@ -110,8 +102,7 @@ void SaveCardBubbleControllerImpl::ShowBubbleForUpload(
AutofillMetrics::SAVE_CARD_PROMPT_END_INVALID_LEGAL_MESSAGE,
is_uploading_, is_reshow_,
pref_service_->GetInteger(
prefs::kAutofillAcceptSaveCreditCardPromptState),
GetSecurityLevel());
prefs::kAutofillAcceptSaveCreditCardPromptState));
return;
}
......@@ -137,8 +128,7 @@ void SaveCardBubbleControllerImpl::ReshowBubble() {
AutofillMetrics::SAVE_CARD_PROMPT_SHOW_REQUESTED, is_uploading_,
is_reshow_,
pref_service_->GetInteger(
prefs::kAutofillAcceptSaveCreditCardPromptState),
GetSecurityLevel());
prefs::kAutofillAcceptSaveCreditCardPromptState));
ShowBubble();
}
......@@ -204,8 +194,7 @@ void SaveCardBubbleControllerImpl::OnSaveButton(
AutofillMetrics::LogSaveCardPromptMetric(
AutofillMetrics::SAVE_CARD_PROMPT_END_ACCEPTED, is_uploading_, is_reshow_,
pref_service_->GetInteger(
prefs::kAutofillAcceptSaveCreditCardPromptState),
GetSecurityLevel());
prefs::kAutofillAcceptSaveCreditCardPromptState));
pref_service_->SetInteger(
prefs::kAutofillAcceptSaveCreditCardPromptState,
prefs::PREVIOUS_SAVE_CREDIT_CARD_PROMPT_USER_DECISION_ACCEPTED);
......@@ -217,8 +206,7 @@ void SaveCardBubbleControllerImpl::OnCancelButton() {
AutofillMetrics::LogSaveCardPromptMetric(
AutofillMetrics::SAVE_CARD_PROMPT_END_DENIED, is_uploading_, is_reshow_,
pref_service_->GetInteger(
prefs::kAutofillAcceptSaveCreditCardPromptState),
GetSecurityLevel());
prefs::kAutofillAcceptSaveCreditCardPromptState));
pref_service_->SetInteger(
prefs::kAutofillAcceptSaveCreditCardPromptState,
prefs::PREVIOUS_SAVE_CREDIT_CARD_PROMPT_USER_DECISION_DENIED);
......@@ -230,8 +218,7 @@ void SaveCardBubbleControllerImpl::OnLegalMessageLinkClicked(const GURL& url) {
AutofillMetrics::SAVE_CARD_PROMPT_DISMISS_CLICK_LEGAL_MESSAGE,
is_uploading_, is_reshow_,
pref_service_->GetInteger(
prefs::kAutofillAcceptSaveCreditCardPromptState),
GetSecurityLevel());
prefs::kAutofillAcceptSaveCreditCardPromptState));
}
void SaveCardBubbleControllerImpl::OnBubbleClosed() {
......@@ -284,8 +271,7 @@ void SaveCardBubbleControllerImpl::DidFinishNavigation(
: AutofillMetrics::SAVE_CARD_PROMPT_END_NAVIGATION_HIDDEN,
is_uploading_, is_reshow_,
pref_service_->GetInteger(
prefs::kAutofillAcceptSaveCreditCardPromptState),
GetSecurityLevel());
prefs::kAutofillAcceptSaveCreditCardPromptState));
}
void SaveCardBubbleControllerImpl::OnVisibilityChanged(
......@@ -336,8 +322,7 @@ void SaveCardBubbleControllerImpl::ShowBubble() {
AutofillMetrics::LogSaveCardPromptMetric(
AutofillMetrics::SAVE_CARD_PROMPT_SHOWN, is_uploading_, is_reshow_,
pref_service_->GetInteger(
prefs::kAutofillAcceptSaveCreditCardPromptState),
GetSecurityLevel());
prefs::kAutofillAcceptSaveCreditCardPromptState));
}
void SaveCardBubbleControllerImpl::UpdateIcon() {
......@@ -354,9 +339,4 @@ void SaveCardBubbleControllerImpl::OpenUrl(const GURL& url) {
ui::PAGE_TRANSITION_LINK, false));
}
security_state::SecurityLevel SaveCardBubbleControllerImpl::GetSecurityLevel()
const {
return security_level_;
}
} // namespace autofill
......@@ -11,7 +11,6 @@
#include "base/timer/elapsed_timer.h"
#include "components/autofill/core/browser/credit_card.h"
#include "components/autofill/core/browser/ui/save_card_bubble_controller.h"
#include "components/security_state/core/security_state.h"
#include "components/signin/core/browser/account_info.h"
#include "content/public/browser/web_contents_observer.h"
#include "content/public/browser/web_contents_user_data.h"
......@@ -82,9 +81,6 @@ class SaveCardBubbleControllerImpl
void OnVisibilityChanged(content::Visibility visibility) override;
void WebContentsDestroyed() override;
// Gets the security level of the page.
virtual security_state::SecurityLevel GetSecurityLevel() const;
private:
friend class content::WebContentsUserData<SaveCardBubbleControllerImpl>;
......@@ -140,9 +136,6 @@ class SaveCardBubbleControllerImpl
// reasonable limit, then don't close the bubble upon navigation.
std::unique_ptr<base::ElapsedTimer> timer_;
// The security level for the current context.
security_state::SecurityLevel security_level_;
DISALLOW_COPY_AND_ASSIGN(SaveCardBubbleControllerImpl);
};
......
......@@ -43,10 +43,6 @@ class TestSaveCardBubbleControllerImpl : public SaveCardBubbleControllerImpl {
void set_elapsed(base::TimeDelta elapsed) { elapsed_ = elapsed; }
void set_security_level(security_state::SecurityLevel security_level) {
security_level_ = security_level;
}
void SimulateNavigation() {
content::RenderFrameHost* rfh = web_contents()->GetMainFrame();
std::unique_ptr<content::NavigationHandle> navigation_handle =
......@@ -58,13 +54,8 @@ class TestSaveCardBubbleControllerImpl : public SaveCardBubbleControllerImpl {
protected:
base::TimeDelta Elapsed() const override { return elapsed_; }
security_state::SecurityLevel GetSecurityLevel() const override {
return security_level_;
}
private:
base::TimeDelta elapsed_;
security_state::SecurityLevel security_level_;
};
class SaveCardBubbleControllerImplTest : public BrowserWithTestWindowTest {
......@@ -683,35 +674,4 @@ TEST_F(SaveCardBubbleControllerImplTest, OnlyOneActiveBubble_UploadThenLocal) {
.empty());
}
TEST_F(SaveCardBubbleControllerImplTest,
LogSaveCardPromptMetricBySecurityLevel_Local) {
base::HistogramTester histogram_tester;
controller()->set_security_level(security_state::SecurityLevel::SECURE);
ShowLocalBubble();
EXPECT_THAT(
histogram_tester.GetAllSamples(
"Security.SaveCardPromptMetric.Local.SECURE"),
ElementsAre(Bucket(AutofillMetrics::SAVE_CARD_PROMPT_SHOW_REQUESTED, 1),
Bucket(AutofillMetrics::SAVE_CARD_PROMPT_SHOWN, 1)));
EXPECT_TRUE(histogram_tester
.GetAllSamples("Security.SaveCardPromptMetric.Upload.SECURE")
.empty());
}
TEST_F(SaveCardBubbleControllerImplTest,
LogSaveCardPromptMetricBySecurityLevel_Upload) {
base::HistogramTester histogram_tester;
controller()->set_security_level(security_state::SecurityLevel::EV_SECURE);
ShowUploadBubble();
EXPECT_THAT(
histogram_tester.GetAllSamples(
"Security.SaveCardPromptMetric.Upload.EV_SECURE"),
ElementsAre(Bucket(AutofillMetrics::SAVE_CARD_PROMPT_SHOW_REQUESTED, 1),
Bucket(AutofillMetrics::SAVE_CARD_PROMPT_SHOWN, 1)));
EXPECT_TRUE(
histogram_tester
.GetAllSamples("Security.SaveCardPromptMetric.Local.EV_SECURE")
.empty());
}
} // namespace autofill
......@@ -230,7 +230,6 @@ static_library("browser") {
"//components/autofill/core/browser/proto",
"//components/autofill/core/common",
"//components/resources",
"//components/security_state/core",
"//skia",
"//third_party/libaddressinput",
]
......@@ -243,6 +242,7 @@ static_library("browser") {
"//components/os_crypt",
"//components/pref_registry",
"//components/prefs",
"//components/security_state/core",
"//components/signin/core/browser:signin_metrics",
"//components/strings",
"//components/sync",
......
......@@ -15,7 +15,6 @@
#include "base/strings/string16.h"
#include "base/values.h"
#include "components/autofill/core/browser/risk_data_loader.h"
#include "components/security_state/core/security_state.h"
#include "services/metrics/public/cpp/ukm_source_id.h"
#include "ui/base/window_open_disposition.h"
#include "url/gurl.h"
......@@ -118,10 +117,6 @@ class AutofillClient : public RiskDataLoader {
// Gets an AddressNormalizer instance (can be null).
virtual AddressNormalizer* GetAddressNormalizer() = 0;
// Gets the security level used for recording histograms for the current
// context if possible, SECURITY_LEVEL_COUNT otherwise.
virtual security_state::SecurityLevel GetSecurityLevelForUmaHistograms() = 0;
// Causes the Autofill settings UI to be shown.
virtual void ShowAutofillSettings() = 0;
......
......@@ -506,9 +506,8 @@ void AutofillManager::OnTextFieldDidChangeImpl(const FormData& form,
if (!user_did_type_) {
user_did_type_ = true;
AutofillMetrics::LogUserHappinessMetric(
AutofillMetrics::USER_DID_TYPE, autofill_field->Type().group(),
client_->GetSecurityLevelForUmaHistograms());
AutofillMetrics::LogUserHappinessMetric(AutofillMetrics::USER_DID_TYPE,
autofill_field->Type().group());
}
if (autofill_field->is_autofilled) {
......@@ -516,15 +515,13 @@ void AutofillManager::OnTextFieldDidChangeImpl(const FormData& form,
autofill_field->set_previously_autofilled(true);
AutofillMetrics::LogUserHappinessMetric(
AutofillMetrics::USER_DID_EDIT_AUTOFILLED_FIELD,
autofill_field->Type().group(),
client_->GetSecurityLevelForUmaHistograms());
autofill_field->Type().group());
if (!user_did_edit_autofilled_field_) {
user_did_edit_autofilled_field_ = true;
AutofillMetrics::LogUserHappinessMetric(
AutofillMetrics::USER_DID_EDIT_AUTOFILLED_FIELD_ONCE,
autofill_field->Type().group(),
client_->GetSecurityLevelForUmaHistograms());
autofill_field->Type().group());
}
}
......@@ -790,14 +787,12 @@ void AutofillManager::OnDidFillAutofillFormData(const FormData& form,
if (FindCachedForm(form, &form_structure)) {
form_types = form_structure->GetFormTypes();
}
AutofillMetrics::LogUserHappinessMetric(
AutofillMetrics::USER_DID_AUTOFILL, form_types,
client_->GetSecurityLevelForUmaHistograms());
AutofillMetrics::LogUserHappinessMetric(AutofillMetrics::USER_DID_AUTOFILL,
form_types);
if (!user_did_autofill_) {
user_did_autofill_ = true;
AutofillMetrics::LogUserHappinessMetric(
AutofillMetrics::USER_DID_AUTOFILL_ONCE, form_types,
client_->GetSecurityLevelForUmaHistograms());
AutofillMetrics::USER_DID_AUTOFILL_ONCE, form_types);
}
UpdateInitialInteractionTimestamp(timestamp);
......@@ -814,16 +809,14 @@ void AutofillManager::DidShowSuggestions(bool has_autofill_suggestions,
return;
if (has_autofill_suggestions) {
AutofillMetrics::LogUserHappinessMetric(
AutofillMetrics::SUGGESTIONS_SHOWN, autofill_field->Type().group(),
client_->GetSecurityLevelForUmaHistograms());
AutofillMetrics::LogUserHappinessMetric(AutofillMetrics::SUGGESTIONS_SHOWN,
autofill_field->Type().group());
if (!did_show_suggestions_) {
did_show_suggestions_ = true;
AutofillMetrics::LogUserHappinessMetric(
AutofillMetrics::SUGGESTIONS_SHOWN_ONCE,
autofill_field->Type().group(),
client_->GetSecurityLevelForUmaHistograms());
autofill_field->Type().group());
}
if (autofill_field->Type().group() == CREDIT_CARD) {
......@@ -1633,9 +1626,8 @@ void AutofillManager::ParseForms(const std::vector<FormData>& forms) {
}
if (!queryable_forms.empty() || !non_queryable_forms.empty()) {
AutofillMetrics::LogUserHappinessMetric(
AutofillMetrics::FORMS_LOADED, form_types,
client_->GetSecurityLevelForUmaHistograms());
AutofillMetrics::LogUserHappinessMetric(AutofillMetrics::FORMS_LOADED,
form_types);
#if defined(OS_IOS)
// Log this from same location as AutofillMetrics::FORMS_LOADED to ensure
......@@ -1937,8 +1929,7 @@ void AutofillManager::FillFieldWithValue(AutofillField* autofill_field,
// fields with non-empty values, such as select-one fields.
field_data->is_autofilled = true;
AutofillMetrics::LogUserHappinessMetric(
AutofillMetrics::FIELD_WAS_AUTOFILLED, autofill_field->Type().group(),
client_->GetSecurityLevelForUmaHistograms());
AutofillMetrics::FIELD_WAS_AUTOFILLED, autofill_field->Type().group());
if (should_notify) {
client_->DidFillOrPreviewField(
......
......@@ -89,31 +89,6 @@ int64_t HashFieldSignature(autofill::FieldSignature field_signature) {
return static_cast<uint64_t>(field_signature) % 1021;
}
std::string GetHistogramSuffixForSecurityLevel(
security_state::SecurityLevel level) {
switch (level) {
case security_state::EV_SECURE:
return "EV_SECURE";
case security_state::SECURE:
return "SECURE";
case security_state::NONE:
return "NONE";
case security_state::HTTP_SHOW_WARNING:
return "HTTP_SHOW_WARNING";
case security_state::SECURE_WITH_POLICY_INSTALLED_CERT:
return "SECURE_WITH_POLICY_INSTALLED_CERT";
case security_state::DANGEROUS:
return "DANGEROUS";
default:
return "OTHER";
}
}
std::string GetSecurityLevelHistogramName(const std::string prefix,
security_state::SecurityLevel level) {
return prefix + "." + GetHistogramSuffixForSecurityLevel(level);
}
} // namespace
// First, translates |field_type| to the corresponding logical |group| from
......@@ -716,8 +691,7 @@ void AutofillMetrics::LogSaveCardPromptMetric(
SaveCardPromptMetric metric,
bool is_uploading,
bool is_reshow,
int previous_save_credit_card_prompt_user_decision,
security_state::SecurityLevel security_level) {
int previous_save_credit_card_prompt_user_decision) {
DCHECK_LT(metric, NUM_SAVE_CARD_PROMPT_METRICS);
std::string destination = is_uploading ? ".Upload" : ".Local";
std::string show = is_reshow ? ".Reshows" : ".FirstShow";
......@@ -729,31 +703,6 @@ void AutofillMetrics::LogSaveCardPromptMetric(
PreviousSaveCreditCardPromptUserDecisionToString(
previous_save_credit_card_prompt_user_decision),
metric, NUM_SAVE_CARD_PROMPT_METRICS);
LogSaveCardPromptMetricBySecurityLevel(metric, is_uploading, security_level);
}
// static
void AutofillMetrics::LogSaveCardPromptMetricBySecurityLevel(
SaveCardPromptMetric metric,
bool is_uploading,
security_state::SecurityLevel security_level) {
// Getting a SECURITY_LEVEL_COUNT security level means that it was not
// possible to get the real security level. Don't log.
if (security_level == security_state::SecurityLevel::SECURITY_LEVEL_COUNT) {
return;
}
std::string histogram_name = "Security.SaveCardPromptMetric.";
if (is_uploading) {
histogram_name += "Upload";
} else {
histogram_name += "Local";
}
base::UmaHistogramEnumeration(
GetSecurityLevelHistogramName(histogram_name, security_level), metric,
NUM_SAVE_CARD_PROMPT_METRICS);
}
// static
......@@ -958,80 +907,35 @@ void AutofillMetrics::LogServerQueryMetric(ServerQueryMetric metric) {
}
// static
void AutofillMetrics::LogUserHappinessMetric(
UserHappinessMetric metric,
FieldTypeGroup field_type_group,
security_state::SecurityLevel security_level) {
void AutofillMetrics::LogUserHappinessMetric(UserHappinessMetric metric,
FieldTypeGroup field_type_group) {
LogUserHappinessMetric(
metric, {FormTypes::FieldTypeGroupToFormType(field_type_group)},
security_level);
metric, {FormTypes::FieldTypeGroupToFormType(field_type_group)});
}
// static
void AutofillMetrics::LogUserHappinessMetric(
UserHappinessMetric metric,
const std::set<FormType>& form_types,
security_state::SecurityLevel security_level) {
const std::set<FormType>& form_types) {
DCHECK_LT(metric, NUM_USER_HAPPINESS_METRICS);
UMA_HISTOGRAM_ENUMERATION("Autofill.UserHappiness", metric,
NUM_USER_HAPPINESS_METRICS);
if (base::ContainsKey(form_types, CREDIT_CARD_FORM)) {
UMA_HISTOGRAM_ENUMERATION("Autofill.UserHappiness.CreditCard", metric,
NUM_USER_HAPPINESS_METRICS);
LogUserHappinessBySecurityLevel(metric, CREDIT_CARD_FORM, security_level);
}
if (base::ContainsKey(form_types, ADDRESS_FORM)) {
UMA_HISTOGRAM_ENUMERATION("Autofill.UserHappiness.Address", metric,
NUM_USER_HAPPINESS_METRICS);
LogUserHappinessBySecurityLevel(metric, ADDRESS_FORM, security_level);
}
if (base::ContainsKey(form_types, PASSWORD_FORM)) {
UMA_HISTOGRAM_ENUMERATION("Autofill.UserHappiness.Password", metric,
NUM_USER_HAPPINESS_METRICS);
LogUserHappinessBySecurityLevel(metric, PASSWORD_FORM, security_level);
}
if (base::ContainsKey(form_types, UNKNOWN_FORM_TYPE)) {
UMA_HISTOGRAM_ENUMERATION("Autofill.UserHappiness.Unknown", metric,
NUM_USER_HAPPINESS_METRICS);
LogUserHappinessBySecurityLevel(metric, UNKNOWN_FORM_TYPE, security_level);
}
}
// static
void AutofillMetrics::LogUserHappinessBySecurityLevel(
UserHappinessMetric metric,
FormType form_type,
security_state::SecurityLevel security_level) {
if (security_level == security_state::SecurityLevel::SECURITY_LEVEL_COUNT) {
return;
}
std::string histogram_name = "Security.UserHappiness.";
switch (form_type) {
case CREDIT_CARD_FORM:
histogram_name += "CreditCard";
break;
case ADDRESS_FORM:
histogram_name += "Address";
break;
case PASSWORD_FORM:
histogram_name += "Password";
break;
case UNKNOWN_FORM_TYPE:
histogram_name += "Unknown";
break;
default:
NOTREACHED();
return;
}
base::UmaHistogramEnumeration(
GetSecurityLevelHistogramName(histogram_name, security_level), metric,
NUM_USER_HAPPINESS_METRICS);
}
// static
......
......@@ -21,7 +21,6 @@
#include "components/autofill/core/common/autofill_pref_names.h"
#include "components/autofill/core/common/form_field_data.h"
#include "components/autofill/core/common/signatures_util.h"
#include "components/security_state/core/security_state.h"
#include "services/metrics/public/cpp/ukm_recorder.h"
namespace autofill {
......@@ -769,12 +768,7 @@ class AutofillMetrics {
SaveCardPromptMetric metric,
bool is_uploading,
bool is_reshow,
int previous_save_credit_card_prompt_user_decision,
security_state::SecurityLevel security_level);
static void LogSaveCardPromptMetricBySecurityLevel(
SaveCardPromptMetric metric,
bool is_uploading,
security_state::SecurityLevel security_level);
int previous_save_credit_card_prompt_user_decision);
static void LogScanCreditCardPromptMetric(ScanCreditCardPromptMetric metric);
// Should be called when credit card scan is finished. |duration| should be
......@@ -807,20 +801,11 @@ class AutofillMetrics {
static void LogServerQueryMetric(ServerQueryMetric metric);
static void LogUserHappinessMetric(
UserHappinessMetric metric,
FieldTypeGroup field_type_group,
security_state::SecurityLevel security_level);
static void LogUserHappinessMetric(
UserHappinessMetric metric,
const std::set<FormType>& form_types,
security_state::SecurityLevel security_level);
static void LogUserHappinessMetric(UserHappinessMetric metric,
FieldTypeGroup field_type_group);
static void LogUserHappinessBySecurityLevel(
UserHappinessMetric metric,
FormType form_type,
security_state::SecurityLevel security_level);
static void LogUserHappinessMetric(UserHappinessMetric metric,
const std::set<FormType>& form_types);
// Logs |event| to the unmask prompt events histogram.
static void LogUnmaskPromptEvent(UnmaskPromptEvent event);
......
......@@ -42,7 +42,6 @@
#include "components/autofill/core/common/form_field_data.h"
#include "components/autofill/core/common/form_field_data_predictions.h"
#include "components/autofill/core/common/signatures_util.h"
#include "components/security_state/core/security_state.h"
#include "services/metrics/public/cpp/ukm_recorder.h"
#include "url/origin.h"
......@@ -792,8 +791,7 @@ void FormStructure::LogQualityMetrics(
auto* const field = this->field(i);
if (IsUPIVirtualPaymentAddress(field->value)) {
AutofillMetrics::LogUserHappinessMetric(
AutofillMetrics::USER_DID_ENTER_UPI_VPA, field->Type().group(),
security_state::SecurityLevel::SECURITY_LEVEL_COUNT);
AutofillMetrics::USER_DID_ENTER_UPI_VPA, field->Type().group());
}
form_interactions_ukm_logger->LogFieldFillStatus(*this, *field,
......
......@@ -56,11 +56,6 @@ AddressNormalizer* TestAutofillClient::GetAddressNormalizer() {
return nullptr;
}
security_state::SecurityLevel
TestAutofillClient::GetSecurityLevelForUmaHistograms() {
return security_state::SecurityLevel::NONE;
}
void TestAutofillClient::ShowAutofillSettings() {
}
......
......@@ -35,7 +35,6 @@ class TestAutofillClient : public AutofillClient {
ukm::UkmRecorder* GetUkmRecorder() override;
ukm::SourceId GetUkmSourceId() override;
AddressNormalizer* GetAddressNormalizer() override;
security_state::SecurityLevel GetSecurityLevelForUmaHistograms() override;
void ShowAutofillSettings() override;
void ShowUnmaskPrompt(const CreditCard& card,
UnmaskCardReason reason,
......
......@@ -28,7 +28,6 @@
#import "ios/chrome/browser/autofill/form_suggestion_controller.h"
#include "ios/chrome/browser/browser_state/test_chrome_browser_state.h"
#include "ios/chrome/browser/infobars/infobar_manager_impl.h"
#include "ios/chrome/browser/ssl/ios_security_state_tab_helper.h"
#import "ios/chrome/browser/ui/autofill/chrome_autofill_client_ios.h"
#include "ios/chrome/browser/ui/settings/personal_data_manager_data_changed_observer.h"
#include "ios/chrome/browser/web/chrome_web_client.h"
......@@ -212,7 +211,6 @@ void AutofillControllerTest::SetUp() {
initWithPrefService:chrome_browser_state_->GetPrefs()
webState:web_state()];
InfoBarManagerImpl::CreateForWebState(web_state());
IOSSecurityStateTabHelper::CreateForWebState(web_state());
autofill_controller_ = [[AutofillController alloc]
initWithBrowserState:chrome_browser_state_.get()
webState:web_state()
......
......@@ -24,7 +24,6 @@
#include "ios/chrome/browser/browser_state/test_chrome_browser_state.h"
#include "ios/chrome/browser/chrome_paths.h"
#include "ios/chrome/browser/infobars/infobar_manager_impl.h"
#include "ios/chrome/browser/ssl/ios_security_state_tab_helper.h"
#include "ios/chrome/browser/web/chrome_web_client.h"
#import "ios/chrome/browser/web/chrome_web_test.h"
#import "ios/web/public/web_state/web_state.h"
......@@ -139,7 +138,6 @@ FormStructureBrowserTest::FormStructureBrowserTest()
void FormStructureBrowserTest::SetUp() {
ChromeWebTest::SetUp();
IOSSecurityStateTabHelper::CreateForWebState(web_state());
InfoBarManagerImpl::CreateForWebState(web_state());
AutofillAgent* autofillAgent = [[AutofillAgent alloc]
initWithPrefService:chrome_browser_state_->GetPrefs()
......
......@@ -50,7 +50,6 @@ class ChromeAutofillClientIOS : public AutofillClient {
ukm::UkmRecorder* GetUkmRecorder() override;
ukm::SourceId GetUkmSourceId() override;
AddressNormalizer* GetAddressNormalizer() override;
security_state::SecurityLevel GetSecurityLevelForUmaHistograms() override;
void ShowAutofillSettings() override;
void ShowUnmaskPrompt(const CreditCard& card,
UnmaskCardReason reason,
......
......@@ -28,7 +28,6 @@
#include "ios/chrome/browser/metrics/ukm_url_recorder.h"
#include "ios/chrome/browser/signin/identity_manager_factory.h"
#import "ios/chrome/browser/ssl/insecure_input_tab_helper.h"
#include "ios/chrome/browser/ssl/ios_security_state_tab_helper.h"
#include "ios/chrome/browser/sync/profile_sync_service_factory.h"
#include "ios/chrome/browser/ui/autofill/card_unmask_prompt_view_bridge.h"
#include "ios/chrome/browser/ui/autofill/save_card_infobar_controller.h"
......@@ -120,20 +119,6 @@ AddressNormalizer* ChromeAutofillClientIOS::GetAddressNormalizer() {
return nullptr;
}
security_state::SecurityLevel
ChromeAutofillClientIOS::GetSecurityLevelForUmaHistograms() {
auto* ios_security_state_tab_helper =
IOSSecurityStateTabHelper::FromWebState(web_state_);
// If there is no helper, return SECURITY_LEVEL_COUNT which won't be logged.
if (!ios_security_state_tab_helper)
return security_state::SecurityLevel::SECURITY_LEVEL_COUNT;
security_state::SecurityInfo result;
ios_security_state_tab_helper->GetSecurityInfo(&result);
return result.security_level;
}
void ChromeAutofillClientIOS::ShowAutofillSettings() {
NOTREACHED();
}
......
......@@ -42,7 +42,6 @@ class WebViewAutofillClientIOS : public AutofillClient {
ukm::UkmRecorder* GetUkmRecorder() override;
ukm::SourceId GetUkmSourceId() override;
AddressNormalizer* GetAddressNormalizer() override;
security_state::SecurityLevel GetSecurityLevelForUmaHistograms() override;
void ShowAutofillSettings() override;
void ShowUnmaskPrompt(const CreditCard& card,
UnmaskCardReason reason,
......
......@@ -66,13 +66,6 @@ AddressNormalizer* WebViewAutofillClientIOS::GetAddressNormalizer() {
return nullptr;
}
security_state::SecurityLevel
WebViewAutofillClientIOS::GetSecurityLevelForUmaHistograms() {
// The metrics are not recorded for iOS webview, so return the count value
// which will not be recorded.
return security_state::SecurityLevel::SECURITY_LEVEL_COUNT;
}
void WebViewAutofillClientIOS::ShowAutofillSettings() {
NOTREACHED();
}
......
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