Commit 3b669c73 authored by csashi's avatar csashi Committed by Commit bot

Logs different SaveCardPrompt histogram names depending on if user

accepted previous save card prompt.

BUG=715617

Review-Url: https://codereview.chromium.org/2839683002
Cr-Commit-Position: refs/heads/master@{#467864}
parent 2a80acc1
...@@ -14,7 +14,9 @@ ...@@ -14,7 +14,9 @@
#include "chrome/test/base/testing_profile.h" #include "chrome/test/base/testing_profile.h"
#include "components/autofill/core/browser/autofill_test_utils.h" #include "components/autofill/core/browser/autofill_test_utils.h"
#include "components/autofill/core/browser/personal_data_manager.h" #include "components/autofill/core/browser/personal_data_manager.h"
#include "components/autofill/core/common/autofill_pref_names.h"
#include "components/infobars/core/confirm_infobar_delegate.h" #include "components/infobars/core/confirm_infobar_delegate.h"
#include "components/prefs/pref_service.h"
#include "testing/gmock/include/gmock/gmock.h" #include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest/include/gtest/gtest.h"
...@@ -54,7 +56,10 @@ class AutofillSaveCardInfoBarDelegateMobileTest ...@@ -54,7 +56,10 @@ class AutofillSaveCardInfoBarDelegateMobileTest
void TearDown() override; void TearDown() override;
protected: protected:
std::unique_ptr<ConfirmInfoBarDelegate> CreateDelegate(bool is_uploading); std::unique_ptr<ConfirmInfoBarDelegate> CreateDelegate(
bool is_uploading,
prefs::PreviousSaveCreditCardPromptUserDecision
previous_save_credit_card_prompt_user_decision);
std::unique_ptr<TestPersonalDataManager> personal_data_; std::unique_ptr<TestPersonalDataManager> personal_data_;
...@@ -80,6 +85,10 @@ void AutofillSaveCardInfoBarDelegateMobileTest::SetUp() { ...@@ -80,6 +85,10 @@ void AutofillSaveCardInfoBarDelegateMobileTest::SetUp() {
personal_data_.reset(new TestPersonalDataManager()); personal_data_.reset(new TestPersonalDataManager());
personal_data_->set_database(autofill_client->GetDatabase()); personal_data_->set_database(autofill_client->GetDatabase());
personal_data_->SetPrefService(profile()->GetPrefs()); personal_data_->SetPrefService(profile()->GetPrefs());
profile()->GetPrefs()->SetInteger(
prefs::kAutofillAcceptSaveCreditCardPromptState,
prefs::PREVIOUS_SAVE_CREDIT_CARD_PROMPT_USER_DECISION_NONE);
} }
void AutofillSaveCardInfoBarDelegateMobileTest::TearDown() { void AutofillSaveCardInfoBarDelegateMobileTest::TearDown() {
...@@ -88,7 +97,10 @@ void AutofillSaveCardInfoBarDelegateMobileTest::TearDown() { ...@@ -88,7 +97,10 @@ void AutofillSaveCardInfoBarDelegateMobileTest::TearDown() {
} }
std::unique_ptr<ConfirmInfoBarDelegate> std::unique_ptr<ConfirmInfoBarDelegate>
AutofillSaveCardInfoBarDelegateMobileTest::CreateDelegate(bool is_uploading) { AutofillSaveCardInfoBarDelegateMobileTest::CreateDelegate(
bool is_uploading,
prefs::PreviousSaveCreditCardPromptUserDecision
previous_save_credit_card_prompt_user_decision) {
base::HistogramTester histogram_tester; base::HistogramTester histogram_tester;
CreditCard credit_card; CreditCard credit_card;
std::unique_ptr<base::DictionaryValue> legal_message; std::unique_ptr<base::DictionaryValue> legal_message;
...@@ -97,11 +109,25 @@ AutofillSaveCardInfoBarDelegateMobileTest::CreateDelegate(bool is_uploading) { ...@@ -97,11 +109,25 @@ AutofillSaveCardInfoBarDelegateMobileTest::CreateDelegate(bool is_uploading) {
is_uploading, credit_card, std::move(legal_message), is_uploading, credit_card, std::move(legal_message),
base::Bind(base::IgnoreResult( base::Bind(base::IgnoreResult(
&TestPersonalDataManager::SaveImportedCreditCard), &TestPersonalDataManager::SaveImportedCreditCard),
base::Unretained(personal_data_.get()), credit_card))); base::Unretained(personal_data_.get()), credit_card),
profile()->GetPrefs()));
std::string destination = is_uploading ? ".Server" : ".Local"; std::string destination = is_uploading ? ".Server" : ".Local";
histogram_tester.ExpectUniqueSample("Autofill.CreditCardInfoBar" std::string previous_response;
+ destination, switch (previous_save_credit_card_prompt_user_decision) {
AutofillMetrics::INFOBAR_SHOWN, 1); case prefs::PREVIOUS_SAVE_CREDIT_CARD_PROMPT_USER_DECISION_ACCEPTED:
previous_response = ".PreviouslyAccepted";
break;
case prefs::PREVIOUS_SAVE_CREDIT_CARD_PROMPT_USER_DECISION_DENIED:
previous_response = ".PreviouslyDenied";
break;
default:
EXPECT_EQ(previous_save_credit_card_prompt_user_decision,
prefs::PREVIOUS_SAVE_CREDIT_CARD_PROMPT_USER_DECISION_NONE);
break;
}
histogram_tester.ExpectUniqueSample(
"Autofill.CreditCardInfoBar" + destination + previous_response,
AutofillMetrics::INFOBAR_SHOWN, 1);
return delegate; return delegate;
} }
...@@ -111,8 +137,9 @@ TEST_F(AutofillSaveCardInfoBarDelegateMobileTest, Metrics_Local) { ...@@ -111,8 +137,9 @@ TEST_F(AutofillSaveCardInfoBarDelegateMobileTest, Metrics_Local) {
// Accept the infobar. // Accept the infobar.
{ {
std::unique_ptr<ConfirmInfoBarDelegate> infobar( std::unique_ptr<ConfirmInfoBarDelegate> infobar(CreateDelegate(
CreateDelegate(/* is_uploading= */ false)); /* is_uploading= */ false,
prefs::PREVIOUS_SAVE_CREDIT_CARD_PROMPT_USER_DECISION_NONE));
EXPECT_CALL(*personal_data_, SaveImportedCreditCard(_)); EXPECT_CALL(*personal_data_, SaveImportedCreditCard(_));
base::HistogramTester histogram_tester; base::HistogramTester histogram_tester;
...@@ -123,35 +150,41 @@ TEST_F(AutofillSaveCardInfoBarDelegateMobileTest, Metrics_Local) { ...@@ -123,35 +150,41 @@ TEST_F(AutofillSaveCardInfoBarDelegateMobileTest, Metrics_Local) {
// Cancel the infobar. // Cancel the infobar.
{ {
std::unique_ptr<ConfirmInfoBarDelegate> infobar( std::unique_ptr<ConfirmInfoBarDelegate> infobar(CreateDelegate(
CreateDelegate(/* is_uploading= */ false)); /* is_uploading= */ false,
prefs::PREVIOUS_SAVE_CREDIT_CARD_PROMPT_USER_DECISION_ACCEPTED));
base::HistogramTester histogram_tester; base::HistogramTester histogram_tester;
EXPECT_TRUE(infobar->Cancel()); EXPECT_TRUE(infobar->Cancel());
histogram_tester.ExpectUniqueSample("Autofill.CreditCardInfoBar.Local", histogram_tester.ExpectUniqueSample(
AutofillMetrics::INFOBAR_DENIED, 1); "Autofill.CreditCardInfoBar.Local.PreviouslyAccepted",
AutofillMetrics::INFOBAR_DENIED, 1);
} }
// Dismiss the infobar. // Dismiss the infobar.
{ {
std::unique_ptr<ConfirmInfoBarDelegate> infobar( std::unique_ptr<ConfirmInfoBarDelegate> infobar(CreateDelegate(
CreateDelegate(/* is_uploading= */ false)); /* is_uploading= */ false,
prefs::PREVIOUS_SAVE_CREDIT_CARD_PROMPT_USER_DECISION_DENIED));
base::HistogramTester histogram_tester; base::HistogramTester histogram_tester;
infobar->InfoBarDismissed(); infobar->InfoBarDismissed();
histogram_tester.ExpectUniqueSample("Autofill.CreditCardInfoBar.Local", histogram_tester.ExpectUniqueSample(
AutofillMetrics::INFOBAR_DENIED, 1); "Autofill.CreditCardInfoBar.Local.PreviouslyDenied",
AutofillMetrics::INFOBAR_DENIED, 1);
} }
// Ignore the infobar. // Ignore the infobar.
{ {
std::unique_ptr<ConfirmInfoBarDelegate> infobar( std::unique_ptr<ConfirmInfoBarDelegate> infobar(CreateDelegate(
CreateDelegate(/* is_uploading= */ false)); /* is_uploading= */ false,
prefs::PREVIOUS_SAVE_CREDIT_CARD_PROMPT_USER_DECISION_DENIED));
base::HistogramTester histogram_tester; base::HistogramTester histogram_tester;
infobar.reset(); infobar.reset();
histogram_tester.ExpectUniqueSample("Autofill.CreditCardInfoBar.Local", histogram_tester.ExpectUniqueSample(
AutofillMetrics::INFOBAR_IGNORED, 1); "Autofill.CreditCardInfoBar.Local.PreviouslyDenied",
AutofillMetrics::INFOBAR_IGNORED, 1);
} }
} }
...@@ -161,8 +194,9 @@ TEST_F(AutofillSaveCardInfoBarDelegateMobileTest, Metrics_Server) { ...@@ -161,8 +194,9 @@ TEST_F(AutofillSaveCardInfoBarDelegateMobileTest, Metrics_Server) {
// Accept the infobar. // Accept the infobar.
{ {
std::unique_ptr<ConfirmInfoBarDelegate> infobar( std::unique_ptr<ConfirmInfoBarDelegate> infobar(CreateDelegate(
CreateDelegate(/* is_uploading= */ true)); /* is_uploading= */ true,
prefs::PREVIOUS_SAVE_CREDIT_CARD_PROMPT_USER_DECISION_NONE));
EXPECT_CALL(*personal_data_, SaveImportedCreditCard(_)); EXPECT_CALL(*personal_data_, SaveImportedCreditCard(_));
base::HistogramTester histogram_tester; base::HistogramTester histogram_tester;
...@@ -173,35 +207,41 @@ TEST_F(AutofillSaveCardInfoBarDelegateMobileTest, Metrics_Server) { ...@@ -173,35 +207,41 @@ TEST_F(AutofillSaveCardInfoBarDelegateMobileTest, Metrics_Server) {
// Cancel the infobar. // Cancel the infobar.
{ {
std::unique_ptr<ConfirmInfoBarDelegate> infobar( std::unique_ptr<ConfirmInfoBarDelegate> infobar(CreateDelegate(
CreateDelegate(/* is_uploading= */ true)); /* is_uploading= */ true,
prefs::PREVIOUS_SAVE_CREDIT_CARD_PROMPT_USER_DECISION_ACCEPTED));
base::HistogramTester histogram_tester; base::HistogramTester histogram_tester;
EXPECT_TRUE(infobar->Cancel()); EXPECT_TRUE(infobar->Cancel());
histogram_tester.ExpectUniqueSample("Autofill.CreditCardInfoBar.Server", histogram_tester.ExpectUniqueSample(
AutofillMetrics::INFOBAR_DENIED, 1); "Autofill.CreditCardInfoBar.Server.PreviouslyAccepted",
AutofillMetrics::INFOBAR_DENIED, 1);
} }
// Dismiss the infobar. // Dismiss the infobar.
{ {
std::unique_ptr<ConfirmInfoBarDelegate> infobar( std::unique_ptr<ConfirmInfoBarDelegate> infobar(CreateDelegate(
CreateDelegate(/* is_uploading= */ true)); /* is_uploading= */ true,
prefs::PREVIOUS_SAVE_CREDIT_CARD_PROMPT_USER_DECISION_DENIED));
base::HistogramTester histogram_tester; base::HistogramTester histogram_tester;
infobar->InfoBarDismissed(); infobar->InfoBarDismissed();
histogram_tester.ExpectUniqueSample("Autofill.CreditCardInfoBar.Server", histogram_tester.ExpectUniqueSample(
AutofillMetrics::INFOBAR_DENIED, 1); "Autofill.CreditCardInfoBar.Server.PreviouslyDenied",
AutofillMetrics::INFOBAR_DENIED, 1);
} }
// Ignore the infobar. // Ignore the infobar.
{ {
std::unique_ptr<ConfirmInfoBarDelegate> infobar( std::unique_ptr<ConfirmInfoBarDelegate> infobar(CreateDelegate(
CreateDelegate(/* is_uploading= */ true)); /* is_uploading= */ true,
prefs::PREVIOUS_SAVE_CREDIT_CARD_PROMPT_USER_DECISION_DENIED));
base::HistogramTester histogram_tester; base::HistogramTester histogram_tester;
infobar.reset(); infobar.reset();
histogram_tester.ExpectUniqueSample("Autofill.CreditCardInfoBar.Server", histogram_tester.ExpectUniqueSample(
AutofillMetrics::INFOBAR_IGNORED, 1); "Autofill.CreditCardInfoBar.Server.PreviouslyDenied",
AutofillMetrics::INFOBAR_IGNORED, 1);
} }
} }
......
...@@ -76,8 +76,6 @@ ChromeAutofillClient::ChromeAutofillClient(content::WebContents* web_contents) ...@@ -76,8 +76,6 @@ ChromeAutofillClient::ChromeAutofillClient(content::WebContents* web_contents)
user_prefs::UserPrefs::Get(web_contents->GetBrowserContext()), user_prefs::UserPrefs::Get(web_contents->GetBrowserContext()),
Profile::FromBrowserContext(web_contents->GetBrowserContext()) Profile::FromBrowserContext(web_contents->GetBrowserContext())
->IsOffTheRecord()) { ->IsOffTheRecord()) {
DCHECK(web_contents);
#if !defined(OS_ANDROID) #if !defined(OS_ANDROID)
// Since ZoomController is also a WebContentsObserver, we need to be careful // Since ZoomController is also a WebContentsObserver, we need to be careful
// about disconnecting from it since the relative order of destruction of // about disconnecting from it since the relative order of destruction of
...@@ -192,7 +190,7 @@ void ChromeAutofillClient::ConfirmSaveCreditCardLocally( ...@@ -192,7 +190,7 @@ void ChromeAutofillClient::ConfirmSaveCreditCardLocally(
->AddInfoBar(CreateSaveCardInfoBarMobile( ->AddInfoBar(CreateSaveCardInfoBarMobile(
base::MakeUnique<AutofillSaveCardInfoBarDelegateMobile>( base::MakeUnique<AutofillSaveCardInfoBarDelegateMobile>(
false, card, std::unique_ptr<base::DictionaryValue>(nullptr), false, card, std::unique_ptr<base::DictionaryValue>(nullptr),
callback))); callback, GetPrefs())));
#else #else
// Do lazy initialization of SaveCardBubbleControllerImpl. // Do lazy initialization of SaveCardBubbleControllerImpl.
autofill::SaveCardBubbleControllerImpl::CreateForWebContents( autofill::SaveCardBubbleControllerImpl::CreateForWebContents(
...@@ -212,7 +210,7 @@ void ChromeAutofillClient::ConfirmSaveCreditCardToCloud( ...@@ -212,7 +210,7 @@ void ChromeAutofillClient::ConfirmSaveCreditCardToCloud(
InfoBarService::FromWebContents(web_contents()) InfoBarService::FromWebContents(web_contents())
->AddInfoBar(CreateSaveCardInfoBarMobile( ->AddInfoBar(CreateSaveCardInfoBarMobile(
base::MakeUnique<AutofillSaveCardInfoBarDelegateMobile>( base::MakeUnique<AutofillSaveCardInfoBarDelegateMobile>(
true, card, std::move(legal_message), callback))); true, card, std::move(legal_message), callback, GetPrefs())));
#else #else
// Do lazy initialization of SaveCardBubbleControllerImpl. // Do lazy initialization of SaveCardBubbleControllerImpl.
autofill::SaveCardBubbleControllerImpl::CreateForWebContents(web_contents()); autofill::SaveCardBubbleControllerImpl::CreateForWebContents(web_contents());
......
...@@ -14,8 +14,11 @@ ...@@ -14,8 +14,11 @@
#include "components/autofill/core/browser/autofill_metrics.h" #include "components/autofill/core/browser/autofill_metrics.h"
#include "components/autofill/core/browser/validation.h" #include "components/autofill/core/browser/validation.h"
#include "components/autofill/core/common/autofill_constants.h" #include "components/autofill/core/common/autofill_constants.h"
#include "components/autofill/core/common/autofill_pref_names.h"
#include "components/grit/components_scaled_resources.h" #include "components/grit/components_scaled_resources.h"
#include "components/prefs/pref_service.h"
#include "components/strings/grit/components_strings.h" #include "components/strings/grit/components_strings.h"
#include "components/user_prefs/user_prefs.h"
#include "content/public/browser/navigation_handle.h" #include "content/public/browser/navigation_handle.h"
#include "ui/base/l10n/l10n_util.h" #include "ui/base/l10n/l10n_util.h"
...@@ -35,9 +38,9 @@ const int kSurviveNavigationSeconds = 5; ...@@ -35,9 +38,9 @@ const int kSurviveNavigationSeconds = 5;
SaveCardBubbleControllerImpl::SaveCardBubbleControllerImpl( SaveCardBubbleControllerImpl::SaveCardBubbleControllerImpl(
content::WebContents* web_contents) content::WebContents* web_contents)
: content::WebContentsObserver(web_contents), : content::WebContentsObserver(web_contents),
save_card_bubble_view_(nullptr) { save_card_bubble_view_(nullptr),
DCHECK(web_contents); pref_service_(
} user_prefs::UserPrefs::Get(web_contents->GetBrowserContext())) {}
SaveCardBubbleControllerImpl::~SaveCardBubbleControllerImpl() { SaveCardBubbleControllerImpl::~SaveCardBubbleControllerImpl() {
if (save_card_bubble_view_) if (save_card_bubble_view_)
...@@ -54,7 +57,9 @@ void SaveCardBubbleControllerImpl::ShowBubbleForLocalSave( ...@@ -54,7 +57,9 @@ void SaveCardBubbleControllerImpl::ShowBubbleForLocalSave(
AutofillMetrics::LogSaveCardPromptMetric( AutofillMetrics::LogSaveCardPromptMetric(
AutofillMetrics::SAVE_CARD_PROMPT_SHOW_REQUESTED, is_uploading_, AutofillMetrics::SAVE_CARD_PROMPT_SHOW_REQUESTED, is_uploading_,
is_reshow_); is_reshow_,
pref_service_->GetInteger(
prefs::kAutofillAcceptSaveCreditCardPromptState));
card_ = card; card_ = card;
save_card_callback_ = save_card_callback; save_card_callback_ = save_card_callback;
...@@ -71,12 +76,16 @@ void SaveCardBubbleControllerImpl::ShowBubbleForUpload( ...@@ -71,12 +76,16 @@ void SaveCardBubbleControllerImpl::ShowBubbleForUpload(
should_cvc_be_requested_ = should_cvc_be_requested; should_cvc_be_requested_ = should_cvc_be_requested;
AutofillMetrics::LogSaveCardPromptMetric( AutofillMetrics::LogSaveCardPromptMetric(
AutofillMetrics::SAVE_CARD_PROMPT_SHOW_REQUESTED, is_uploading_, AutofillMetrics::SAVE_CARD_PROMPT_SHOW_REQUESTED, is_uploading_,
is_reshow_); is_reshow_,
pref_service_->GetInteger(
prefs::kAutofillAcceptSaveCreditCardPromptState));
if (!LegalMessageLine::Parse(*legal_message, &legal_message_lines_)) { if (!LegalMessageLine::Parse(*legal_message, &legal_message_lines_)) {
AutofillMetrics::LogSaveCardPromptMetric( AutofillMetrics::LogSaveCardPromptMetric(
AutofillMetrics::SAVE_CARD_PROMPT_END_INVALID_LEGAL_MESSAGE, AutofillMetrics::SAVE_CARD_PROMPT_END_INVALID_LEGAL_MESSAGE,
is_uploading_, is_reshow_); is_uploading_, is_reshow_,
pref_service_->GetInteger(
prefs::kAutofillAcceptSaveCreditCardPromptState));
return; return;
} }
...@@ -96,7 +105,9 @@ void SaveCardBubbleControllerImpl::ReshowBubble() { ...@@ -96,7 +105,9 @@ void SaveCardBubbleControllerImpl::ReshowBubble() {
is_reshow_ = true; is_reshow_ = true;
AutofillMetrics::LogSaveCardPromptMetric( AutofillMetrics::LogSaveCardPromptMetric(
AutofillMetrics::SAVE_CARD_PROMPT_SHOW_REQUESTED, is_uploading_, AutofillMetrics::SAVE_CARD_PROMPT_SHOW_REQUESTED, is_uploading_,
is_reshow_); is_reshow_,
pref_service_->GetInteger(
prefs::kAutofillAcceptSaveCreditCardPromptState));
ShowBubble(); ShowBubble();
} }
...@@ -151,28 +162,41 @@ void SaveCardBubbleControllerImpl::OnSaveButton(const base::string16& cvc) { ...@@ -151,28 +162,41 @@ void SaveCardBubbleControllerImpl::OnSaveButton(const base::string16& cvc) {
save_card_callback_.Run(); save_card_callback_.Run();
save_card_callback_.Reset(); save_card_callback_.Reset();
AutofillMetrics::LogSaveCardPromptMetric( AutofillMetrics::LogSaveCardPromptMetric(
AutofillMetrics::SAVE_CARD_PROMPT_END_ACCEPTED, is_uploading_, AutofillMetrics::SAVE_CARD_PROMPT_END_ACCEPTED, is_uploading_, is_reshow_,
is_reshow_); pref_service_->GetInteger(
prefs::kAutofillAcceptSaveCreditCardPromptState));
pref_service_->SetInteger(
prefs::kAutofillAcceptSaveCreditCardPromptState,
prefs::PREVIOUS_SAVE_CREDIT_CARD_PROMPT_USER_DECISION_ACCEPTED);
} }
void SaveCardBubbleControllerImpl::OnCancelButton() { void SaveCardBubbleControllerImpl::OnCancelButton() {
save_card_callback_.Reset(); save_card_callback_.Reset();
AutofillMetrics::LogSaveCardPromptMetric( AutofillMetrics::LogSaveCardPromptMetric(
AutofillMetrics::SAVE_CARD_PROMPT_END_DENIED, is_uploading_, is_reshow_); AutofillMetrics::SAVE_CARD_PROMPT_END_DENIED, is_uploading_, is_reshow_,
pref_service_->GetInteger(
prefs::kAutofillAcceptSaveCreditCardPromptState));
pref_service_->SetInteger(
prefs::kAutofillAcceptSaveCreditCardPromptState,
prefs::PREVIOUS_SAVE_CREDIT_CARD_PROMPT_USER_DECISION_DENIED);
} }
void SaveCardBubbleControllerImpl::OnLearnMoreClicked() { void SaveCardBubbleControllerImpl::OnLearnMoreClicked() {
OpenUrl(GURL(kHelpURL)); OpenUrl(GURL(kHelpURL));
AutofillMetrics::LogSaveCardPromptMetric( AutofillMetrics::LogSaveCardPromptMetric(
AutofillMetrics::SAVE_CARD_PROMPT_DISMISS_CLICK_LEARN_MORE, is_uploading_, AutofillMetrics::SAVE_CARD_PROMPT_DISMISS_CLICK_LEARN_MORE, is_uploading_,
is_reshow_); is_reshow_,
pref_service_->GetInteger(
prefs::kAutofillAcceptSaveCreditCardPromptState));
} }
void SaveCardBubbleControllerImpl::OnLegalMessageLinkClicked(const GURL& url) { void SaveCardBubbleControllerImpl::OnLegalMessageLinkClicked(const GURL& url) {
OpenUrl(url); OpenUrl(url);
AutofillMetrics::LogSaveCardPromptMetric( AutofillMetrics::LogSaveCardPromptMetric(
AutofillMetrics::SAVE_CARD_PROMPT_DISMISS_CLICK_LEGAL_MESSAGE, AutofillMetrics::SAVE_CARD_PROMPT_DISMISS_CLICK_LEGAL_MESSAGE,
is_uploading_, is_reshow_); is_uploading_, is_reshow_,
pref_service_->GetInteger(
prefs::kAutofillAcceptSaveCreditCardPromptState));
} }
void SaveCardBubbleControllerImpl::OnBubbleClosed() { void SaveCardBubbleControllerImpl::OnBubbleClosed() {
...@@ -222,13 +246,17 @@ void SaveCardBubbleControllerImpl::DidFinishNavigation( ...@@ -222,13 +246,17 @@ void SaveCardBubbleControllerImpl::DidFinishNavigation(
AutofillMetrics::LogSaveCardPromptMetric( AutofillMetrics::LogSaveCardPromptMetric(
AutofillMetrics::SAVE_CARD_PROMPT_END_NAVIGATION_SHOWING, is_uploading_, AutofillMetrics::SAVE_CARD_PROMPT_END_NAVIGATION_SHOWING, is_uploading_,
is_reshow_); is_reshow_,
pref_service_->GetInteger(
prefs::kAutofillAcceptSaveCreditCardPromptState));
} else { } else {
UpdateIcon(); UpdateIcon();
AutofillMetrics::LogSaveCardPromptMetric( AutofillMetrics::LogSaveCardPromptMetric(
AutofillMetrics::SAVE_CARD_PROMPT_END_NAVIGATION_HIDDEN, is_uploading_, AutofillMetrics::SAVE_CARD_PROMPT_END_NAVIGATION_HIDDEN, is_uploading_,
is_reshow_); is_reshow_,
pref_service_->GetInteger(
prefs::kAutofillAcceptSaveCreditCardPromptState));
} }
} }
...@@ -252,7 +280,9 @@ void SaveCardBubbleControllerImpl::ShowBubble() { ...@@ -252,7 +280,9 @@ void SaveCardBubbleControllerImpl::ShowBubble() {
timer_.reset(new base::ElapsedTimer()); timer_.reset(new base::ElapsedTimer());
AutofillMetrics::LogSaveCardPromptMetric( AutofillMetrics::LogSaveCardPromptMetric(
AutofillMetrics::SAVE_CARD_PROMPT_SHOWN, is_uploading_, is_reshow_); AutofillMetrics::SAVE_CARD_PROMPT_SHOWN, is_uploading_, is_reshow_,
pref_service_->GetInteger(
prefs::kAutofillAcceptSaveCreditCardPromptState));
} }
void SaveCardBubbleControllerImpl::UpdateIcon() { void SaveCardBubbleControllerImpl::UpdateIcon() {
......
...@@ -14,6 +14,8 @@ ...@@ -14,6 +14,8 @@
#include "content/public/browser/web_contents_observer.h" #include "content/public/browser/web_contents_observer.h"
#include "content/public/browser/web_contents_user_data.h" #include "content/public/browser/web_contents_user_data.h"
class PrefService;
namespace autofill { namespace autofill {
// Implementation of per-tab class to control the save credit card bubble and // Implementation of per-tab class to control the save credit card bubble and
...@@ -93,6 +95,9 @@ class SaveCardBubbleControllerImpl ...@@ -93,6 +95,9 @@ class SaveCardBubbleControllerImpl
// Weak reference. Will be nullptr if no bubble is currently shown. // Weak reference. Will be nullptr if no bubble is currently shown.
SaveCardBubbleView* save_card_bubble_view_; SaveCardBubbleView* save_card_bubble_view_;
// Weak reference to read & write |kAutofillAcceptSaveCreditCardPromptState|.
PrefService* pref_service_;
// Callback to run if user presses Save button in the bubble. // Callback to run if user presses Save button in the bubble.
// If save_card_callback_.is_null() is true then no bubble is available to // If save_card_callback_.is_null() is true then no bubble is available to
// show and the icon is not visible. // show and the icon is not visible.
......
...@@ -18,6 +18,8 @@ ...@@ -18,6 +18,8 @@
#include "chrome/test/base/chrome_render_view_host_test_harness.h" #include "chrome/test/base/chrome_render_view_host_test_harness.h"
#include "components/autofill/core/browser/autofill_metrics.h" #include "components/autofill/core/browser/autofill_metrics.h"
#include "components/autofill/core/browser/credit_card.h" #include "components/autofill/core/browser/credit_card.h"
#include "components/autofill/core/common/autofill_pref_names.h"
#include "components/user_prefs/user_prefs.h"
#include "content/public/browser/navigation_handle.h" #include "content/public/browser/navigation_handle.h"
#include "testing/gmock/include/gmock/gmock.h" #include "testing/gmock/include/gmock/gmock.h"
#include "testing/gtest/include/gtest/gtest.h" #include "testing/gtest/include/gtest/gtest.h"
...@@ -61,8 +63,13 @@ class SaveCardBubbleControllerImplTest : public BrowserWithTestWindowTest { ...@@ -61,8 +63,13 @@ class SaveCardBubbleControllerImplTest : public BrowserWithTestWindowTest {
void SetUp() override { void SetUp() override {
BrowserWithTestWindowTest::SetUp(); BrowserWithTestWindowTest::SetUp();
AddTab(browser(), GURL("about:blank")); AddTab(browser(), GURL("about:blank"));
TestSaveCardBubbleControllerImpl::CreateForTesting( content::WebContents* web_contents =
browser()->tab_strip_model()->GetActiveWebContents()); browser()->tab_strip_model()->GetActiveWebContents();
TestSaveCardBubbleControllerImpl::CreateForTesting(web_contents);
user_prefs::UserPrefs::Get(web_contents->GetBrowserContext())
->SetInteger(
prefs::kAutofillAcceptSaveCreditCardPromptState,
prefs::PREVIOUS_SAVE_CREDIT_CARD_PROMPT_USER_DECISION_NONE);
} }
BrowserWindow* CreateBrowserWindow() override { BrowserWindow* CreateBrowserWindow() override {
...@@ -266,6 +273,63 @@ TEST_F(SaveCardBubbleControllerImplTest, Metrics_Local_Reshows_CancelButton) { ...@@ -266,6 +273,63 @@ TEST_F(SaveCardBubbleControllerImplTest, Metrics_Local_Reshows_CancelButton) {
AutofillMetrics::SAVE_CARD_PROMPT_END_DENIED, 1); AutofillMetrics::SAVE_CARD_PROMPT_END_DENIED, 1);
} }
TEST_F(SaveCardBubbleControllerImplTest,
Metrics_Local_FirstShow_CancelButton_FirstShow) {
base::HistogramTester histogram_tester;
ShowLocalBubble();
controller()->OnCancelButton();
controller()->OnBubbleClosed();
ShowLocalBubble();
controller()->OnCancelButton();
controller()->OnBubbleClosed();
EXPECT_THAT(
histogram_tester.GetAllSamples(
"Autofill.SaveCreditCardPrompt.Local.FirstShow"),
ElementsAre(Bucket(AutofillMetrics::SAVE_CARD_PROMPT_SHOW_REQUESTED, 1),
Bucket(AutofillMetrics::SAVE_CARD_PROMPT_SHOWN, 1),
Bucket(AutofillMetrics::SAVE_CARD_PROMPT_END_DENIED, 1)));
EXPECT_THAT(
histogram_tester.GetAllSamples(
"Autofill.SaveCreditCardPrompt.Local.FirstShow.PreviouslyDenied"),
ElementsAre(Bucket(AutofillMetrics::SAVE_CARD_PROMPT_SHOW_REQUESTED, 1),
Bucket(AutofillMetrics::SAVE_CARD_PROMPT_SHOWN, 1),
Bucket(AutofillMetrics::SAVE_CARD_PROMPT_END_DENIED, 1)));
}
TEST_F(SaveCardBubbleControllerImplTest,
Metrics_Local_FirstShow_CancelButton_FirstShow_SaveButton_FirstShow) {
base::HistogramTester histogram_tester;
ShowLocalBubble();
controller()->OnCancelButton();
controller()->OnBubbleClosed();
ShowLocalBubble();
controller()->OnSaveButton();
controller()->OnBubbleClosed();
ShowLocalBubble();
EXPECT_THAT(
histogram_tester.GetAllSamples(
"Autofill.SaveCreditCardPrompt.Local.FirstShow"),
ElementsAre(Bucket(AutofillMetrics::SAVE_CARD_PROMPT_SHOW_REQUESTED, 1),
Bucket(AutofillMetrics::SAVE_CARD_PROMPT_SHOWN, 1),
Bucket(AutofillMetrics::SAVE_CARD_PROMPT_END_DENIED, 1)));
EXPECT_THAT(
histogram_tester.GetAllSamples(
"Autofill.SaveCreditCardPrompt.Local.FirstShow.PreviouslyAccepted"),
ElementsAre(Bucket(AutofillMetrics::SAVE_CARD_PROMPT_SHOW_REQUESTED, 1),
Bucket(AutofillMetrics::SAVE_CARD_PROMPT_SHOWN, 1)));
EXPECT_THAT(
histogram_tester.GetAllSamples(
"Autofill.SaveCreditCardPrompt.Local.FirstShow.PreviouslyDenied"),
ElementsAre(Bucket(AutofillMetrics::SAVE_CARD_PROMPT_SHOW_REQUESTED, 1),
Bucket(AutofillMetrics::SAVE_CARD_PROMPT_SHOWN, 1),
Bucket(AutofillMetrics::SAVE_CARD_PROMPT_END_ACCEPTED, 1)));
}
TEST_F(SaveCardBubbleControllerImplTest, TEST_F(SaveCardBubbleControllerImplTest,
Metrics_Local_FirstShow_NavigateWhileShowing) { Metrics_Local_FirstShow_NavigateWhileShowing) {
ShowLocalBubble(); ShowLocalBubble();
......
...@@ -284,6 +284,9 @@ void AutofillManager::RegisterProfilePrefs( ...@@ -284,6 +284,9 @@ void AutofillManager::RegisterProfilePrefs(
registry->RegisterBooleanPref(prefs::kAutofillWalletImportEnabled, true); registry->RegisterBooleanPref(prefs::kAutofillWalletImportEnabled, true);
registry->RegisterBooleanPref( registry->RegisterBooleanPref(
prefs::kAutofillWalletImportStorageCheckboxState, true); prefs::kAutofillWalletImportStorageCheckboxState, true);
registry->RegisterIntegerPref(
prefs::kAutofillAcceptSaveCreditCardPromptState,
prefs::PREVIOUS_SAVE_CREDIT_CARD_PROMPT_USER_DECISION_NONE);
} }
void AutofillManager::SetExternalDelegate(AutofillExternalDelegate* delegate) { void AutofillManager::SetExternalDelegate(AutofillExternalDelegate* delegate) {
......
...@@ -80,6 +80,23 @@ enum FieldTypeGroupForMetrics { ...@@ -80,6 +80,23 @@ enum FieldTypeGroupForMetrics {
NUM_FIELD_TYPE_GROUPS_FOR_METRICS NUM_FIELD_TYPE_GROUPS_FOR_METRICS
}; };
std::string PreviousSaveCreditCardPromptUserDecisionToString(
int previous_save_credit_card_prompt_user_decision) {
DCHECK_LT(previous_save_credit_card_prompt_user_decision,
prefs::NUM_PREVIOUS_SAVE_CREDIT_CARD_PROMPT_USER_DECISIONS);
std::string previous_response;
if (previous_save_credit_card_prompt_user_decision ==
prefs::PREVIOUS_SAVE_CREDIT_CARD_PROMPT_USER_DECISION_ACCEPTED)
previous_response = ".PreviouslyAccepted";
else if (previous_save_credit_card_prompt_user_decision ==
prefs::PREVIOUS_SAVE_CREDIT_CARD_PROMPT_USER_DECISION_DENIED)
previous_response = ".PreviouslyDenied";
else
DCHECK_EQ(previous_save_credit_card_prompt_user_decision,
prefs::PREVIOUS_SAVE_CREDIT_CARD_PROMPT_USER_DECISION_NONE);
return previous_response;
}
} // namespace } // namespace
// First, translates |field_type| to the corresponding logical |group| from // First, translates |field_type| to the corresponding logical |group| from
...@@ -298,16 +315,18 @@ void AutofillMetrics::LogCardUploadDecisionMetric( ...@@ -298,16 +315,18 @@ void AutofillMetrics::LogCardUploadDecisionMetric(
} }
// static // static
void AutofillMetrics::LogCreditCardInfoBarMetric(InfoBarMetric metric, void AutofillMetrics::LogCreditCardInfoBarMetric(
bool is_uploading) { InfoBarMetric metric,
bool is_uploading,
int previous_save_credit_card_prompt_user_decision) {
DCHECK_LT(metric, NUM_INFO_BAR_METRICS); DCHECK_LT(metric, NUM_INFO_BAR_METRICS);
if (is_uploading) {
UMA_HISTOGRAM_ENUMERATION("Autofill.CreditCardInfoBar.Server", metric, std::string destination = is_uploading ? ".Server" : ".Local";
NUM_INFO_BAR_METRICS); LogUMAHistogramEnumeration(
} else { "Autofill.CreditCardInfoBar" + destination +
UMA_HISTOGRAM_ENUMERATION("Autofill.CreditCardInfoBar.Local", metric, PreviousSaveCreditCardPromptUserDecisionToString(
NUM_INFO_BAR_METRICS); previous_save_credit_card_prompt_user_decision),
} metric, NUM_INFO_BAR_METRICS);
} }
// static // static
...@@ -318,15 +337,19 @@ void AutofillMetrics::LogCreditCardFillingInfoBarMetric(InfoBarMetric metric) { ...@@ -318,15 +337,19 @@ void AutofillMetrics::LogCreditCardFillingInfoBarMetric(InfoBarMetric metric) {
} }
// static // static
void AutofillMetrics::LogSaveCardPromptMetric(SaveCardPromptMetric metric, void AutofillMetrics::LogSaveCardPromptMetric(
bool is_uploading, SaveCardPromptMetric metric,
bool is_reshow) { bool is_uploading,
bool is_reshow,
int previous_save_credit_card_prompt_user_decision) {
DCHECK_LT(metric, NUM_SAVE_CARD_PROMPT_METRICS); DCHECK_LT(metric, NUM_SAVE_CARD_PROMPT_METRICS);
std::string destination = is_uploading ? ".Upload" : ".Local"; std::string destination = is_uploading ? ".Upload" : ".Local";
std::string show = is_reshow ? ".Reshows" : ".FirstShow"; std::string show = is_reshow ? ".Reshows" : ".FirstShow";
LogUMAHistogramEnumeration( LogUMAHistogramEnumeration(
"Autofill.SaveCreditCardPrompt" + destination + show, metric, "Autofill.SaveCreditCardPrompt" + destination + show +
NUM_SAVE_CARD_PROMPT_METRICS); PreviousSaveCreditCardPromptUserDecisionToString(
previous_save_credit_card_prompt_user_decision),
metric, NUM_SAVE_CARD_PROMPT_METRICS);
} }
// static // static
......
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
#include "components/autofill/core/browser/autofill_profile.h" #include "components/autofill/core/browser/autofill_profile.h"
#include "components/autofill/core/browser/credit_card.h" #include "components/autofill/core/browser/credit_card.h"
#include "components/autofill/core/browser/field_types.h" #include "components/autofill/core/browser/field_types.h"
#include "components/autofill/core/common/autofill_pref_names.h"
#include "components/autofill/core/common/form_field_data.h" #include "components/autofill/core/common/form_field_data.h"
namespace ukm { namespace ukm {
...@@ -645,12 +646,16 @@ class AutofillMetrics { ...@@ -645,12 +646,16 @@ class AutofillMetrics {
}; };
static void LogCardUploadDecisionMetric(CardUploadDecisionMetric metric); static void LogCardUploadDecisionMetric(CardUploadDecisionMetric metric);
static void LogCreditCardInfoBarMetric(InfoBarMetric metric, static void LogCreditCardInfoBarMetric(
bool is_uploading); InfoBarMetric metric,
bool is_uploading,
int previous_save_credit_card_prompt_user_decision);
static void LogCreditCardFillingInfoBarMetric(InfoBarMetric metric); static void LogCreditCardFillingInfoBarMetric(InfoBarMetric metric);
static void LogSaveCardPromptMetric(SaveCardPromptMetric metric, static void LogSaveCardPromptMetric(
bool is_uploading, SaveCardPromptMetric metric,
bool is_reshow); bool is_uploading,
bool is_reshow,
int previous_save_credit_card_prompt_user_decision);
static void LogScanCreditCardPromptMetric(ScanCreditCardPromptMetric metric); static void LogScanCreditCardPromptMetric(ScanCreditCardPromptMetric metric);
// Should be called when credit card scan is finished. |duration| should be // Should be called when credit card scan is finished. |duration| should be
......
...@@ -11,9 +11,11 @@ ...@@ -11,9 +11,11 @@
#include "components/autofill/core/browser/credit_card.h" #include "components/autofill/core/browser/credit_card.h"
#include "components/autofill/core/browser/legal_message_line.h" #include "components/autofill/core/browser/legal_message_line.h"
#include "components/autofill/core/common/autofill_constants.h" #include "components/autofill/core/common/autofill_constants.h"
#include "components/autofill/core/common/autofill_pref_names.h"
#include "components/grit/components_scaled_resources.h" #include "components/grit/components_scaled_resources.h"
#include "components/infobars/core/infobar.h" #include "components/infobars/core/infobar.h"
#include "components/infobars/core/infobar_manager.h" #include "components/infobars/core/infobar_manager.h"
#include "components/prefs/pref_service.h"
#include "components/strings/grit/components_strings.h" #include "components/strings/grit/components_strings.h"
#include "ui/base/l10n/l10n_util.h" #include "ui/base/l10n/l10n_util.h"
#include "ui/base/window_open_disposition.h" #include "ui/base/window_open_disposition.h"
...@@ -25,10 +27,12 @@ AutofillSaveCardInfoBarDelegateMobile::AutofillSaveCardInfoBarDelegateMobile( ...@@ -25,10 +27,12 @@ AutofillSaveCardInfoBarDelegateMobile::AutofillSaveCardInfoBarDelegateMobile(
bool upload, bool upload,
const CreditCard& card, const CreditCard& card,
std::unique_ptr<base::DictionaryValue> legal_message, std::unique_ptr<base::DictionaryValue> legal_message,
const base::Closure& save_card_callback) const base::Closure& save_card_callback,
PrefService* pref_service)
: ConfirmInfoBarDelegate(), : ConfirmInfoBarDelegate(),
upload_(upload), upload_(upload),
save_card_callback_(save_card_callback), save_card_callback_(save_card_callback),
pref_service_(pref_service),
had_user_interaction_(false), had_user_interaction_(false),
#if defined(OS_IOS) #if defined(OS_IOS)
// TODO(jdonnelly): Use credit card issuer images on iOS. // TODO(jdonnelly): Use credit card issuer images on iOS.
...@@ -42,8 +46,10 @@ AutofillSaveCardInfoBarDelegateMobile::AutofillSaveCardInfoBarDelegateMobile( ...@@ -42,8 +46,10 @@ AutofillSaveCardInfoBarDelegateMobile::AutofillSaveCardInfoBarDelegateMobile(
if (legal_message) if (legal_message)
LegalMessageLine::Parse(*legal_message, &legal_messages_); LegalMessageLine::Parse(*legal_message, &legal_messages_);
AutofillMetrics::LogCreditCardInfoBarMetric(AutofillMetrics::INFOBAR_SHOWN, AutofillMetrics::LogCreditCardInfoBarMetric(
upload_); AutofillMetrics::INFOBAR_SHOWN, upload_,
pref_service_->GetInteger(
prefs::kAutofillAcceptSaveCreditCardPromptState));
} }
AutofillSaveCardInfoBarDelegateMobile:: AutofillSaveCardInfoBarDelegateMobile::
...@@ -120,7 +126,15 @@ void AutofillSaveCardInfoBarDelegateMobile::LogUserAction( ...@@ -120,7 +126,15 @@ void AutofillSaveCardInfoBarDelegateMobile::LogUserAction(
AutofillMetrics::InfoBarMetric user_action) { AutofillMetrics::InfoBarMetric user_action) {
DCHECK(!had_user_interaction_); DCHECK(!had_user_interaction_);
AutofillMetrics::LogCreditCardInfoBarMetric(user_action, upload_); AutofillMetrics::LogCreditCardInfoBarMetric(
user_action, upload_,
pref_service_->GetInteger(
prefs::kAutofillAcceptSaveCreditCardPromptState));
pref_service_->SetInteger(
prefs::kAutofillAcceptSaveCreditCardPromptState,
user_action == AutofillMetrics::INFOBAR_ACCEPTED
? prefs::PREVIOUS_SAVE_CREDIT_CARD_PROMPT_USER_DECISION_ACCEPTED
: prefs::PREVIOUS_SAVE_CREDIT_CARD_PROMPT_USER_DECISION_DENIED);
had_user_interaction_ = true; had_user_interaction_ = true;
} }
......
...@@ -14,6 +14,8 @@ ...@@ -14,6 +14,8 @@
#include "components/autofill/core/browser/legal_message_line.h" #include "components/autofill/core/browser/legal_message_line.h"
#include "components/infobars/core/confirm_infobar_delegate.h" #include "components/infobars/core/confirm_infobar_delegate.h"
class PrefService;
namespace base { namespace base {
class DictionaryValue; class DictionaryValue;
} }
...@@ -30,7 +32,8 @@ class AutofillSaveCardInfoBarDelegateMobile : public ConfirmInfoBarDelegate { ...@@ -30,7 +32,8 @@ class AutofillSaveCardInfoBarDelegateMobile : public ConfirmInfoBarDelegate {
bool upload, bool upload,
const CreditCard& card, const CreditCard& card,
std::unique_ptr<base::DictionaryValue> legal_message, std::unique_ptr<base::DictionaryValue> legal_message,
const base::Closure& save_card_callback); const base::Closure& save_card_callback,
PrefService* pref_service);
~AutofillSaveCardInfoBarDelegateMobile() override; ~AutofillSaveCardInfoBarDelegateMobile() override;
...@@ -64,6 +67,9 @@ class AutofillSaveCardInfoBarDelegateMobile : public ConfirmInfoBarDelegate { ...@@ -64,6 +67,9 @@ class AutofillSaveCardInfoBarDelegateMobile : public ConfirmInfoBarDelegate {
// The callback to save credit card if the user accepts the infobar. // The callback to save credit card if the user accepts the infobar.
base::Closure save_card_callback_; base::Closure save_card_callback_;
// Weak reference to read & write |kAutofillAcceptSaveCreditCardPromptState|,
PrefService* pref_service_;
// Did the user ever explicitly accept or dismiss this infobar? // Did the user ever explicitly accept or dismiss this infobar?
bool had_user_interaction_; bool had_user_interaction_;
......
...@@ -26,10 +26,17 @@ const char kAutofillWalletImportEnabled[] = "autofill.wallet_import_enabled"; ...@@ -26,10 +26,17 @@ const char kAutofillWalletImportEnabled[] = "autofill.wallet_import_enabled";
// was run. This routine will be run once per version. // was run. This routine will be run once per version.
const char kAutofillLastVersionDeduped[] = "autofill.last_version_deduped"; const char kAutofillLastVersionDeduped[] = "autofill.last_version_deduped";
// Boolean that allows the "Don't ask again for this card" checkbox to be // Boolean that is set to the last choice user made when prompted for saving an
// sticky. // unmasked server card locally.
const char kAutofillWalletImportStorageCheckboxState[] = const char kAutofillWalletImportStorageCheckboxState[] =
"autofill.wallet_import_storage_checkbox_state"; "autofill.wallet_import_storage_checkbox_state";
// Integer that is set to the last choice user made when prompted for saving a
// credit card. The prompt is for user's consent in saving the card in the
// server for signed in users and saving the card locally for non signed-in
// users.
const char kAutofillAcceptSaveCreditCardPromptState[] =
"autofill.accept_save_credit_card_prompt_state";
} // namespace prefs } // namespace prefs
} // namespace autofill } // namespace autofill
...@@ -11,6 +11,7 @@ namespace prefs { ...@@ -11,6 +11,7 @@ namespace prefs {
// Alphabetical list of preference names specific to the Autofill // Alphabetical list of preference names specific to the Autofill
// component. Keep alphabetized, and document each in the .cc file. // component. Keep alphabetized, and document each in the .cc file.
extern const char kAutofillAcceptSaveCreditCardPromptState[];
extern const char kAutofillCreditCardSigninPromoImpressionCount[]; extern const char kAutofillCreditCardSigninPromoImpressionCount[];
extern const char kAutofillEnabled[]; extern const char kAutofillEnabled[];
extern const char kAutofillProfileUseDatesFixed[]; extern const char kAutofillProfileUseDatesFixed[];
...@@ -18,6 +19,15 @@ extern const char kAutofillLastVersionDeduped[]; ...@@ -18,6 +19,15 @@ extern const char kAutofillLastVersionDeduped[];
extern const char kAutofillWalletImportEnabled[]; extern const char kAutofillWalletImportEnabled[];
extern const char kAutofillWalletImportStorageCheckboxState[]; extern const char kAutofillWalletImportStorageCheckboxState[];
// Possible values for previous user decision when we displayed a save credit
// card prompt.
enum PreviousSaveCreditCardPromptUserDecision {
PREVIOUS_SAVE_CREDIT_CARD_PROMPT_USER_DECISION_NONE,
PREVIOUS_SAVE_CREDIT_CARD_PROMPT_USER_DECISION_ACCEPTED,
PREVIOUS_SAVE_CREDIT_CARD_PROMPT_USER_DECISION_DENIED,
NUM_PREVIOUS_SAVE_CREDIT_CARD_PROMPT_USER_DECISIONS
};
} // namespace prefs } // namespace prefs
} // namespace autofill } // namespace autofill
......
...@@ -118,7 +118,7 @@ void AutofillClientIOS::ConfirmSaveCreditCardLocally( ...@@ -118,7 +118,7 @@ void AutofillClientIOS::ConfirmSaveCreditCardLocally(
infobar_manager_->AddInfoBar(CreateSaveCardInfoBarMobile( infobar_manager_->AddInfoBar(CreateSaveCardInfoBarMobile(
base::MakeUnique<AutofillSaveCardInfoBarDelegateMobile>( base::MakeUnique<AutofillSaveCardInfoBarDelegateMobile>(
false, card, std::unique_ptr<base::DictionaryValue>(nullptr), false, card, std::unique_ptr<base::DictionaryValue>(nullptr),
callback))); callback, GetPrefs())));
} }
void AutofillClientIOS::ConfirmSaveCreditCardToCloud( void AutofillClientIOS::ConfirmSaveCreditCardToCloud(
...@@ -128,7 +128,7 @@ void AutofillClientIOS::ConfirmSaveCreditCardToCloud( ...@@ -128,7 +128,7 @@ void AutofillClientIOS::ConfirmSaveCreditCardToCloud(
const base::Closure& callback) { const base::Closure& callback) {
infobar_manager_->AddInfoBar(CreateSaveCardInfoBarMobile( infobar_manager_->AddInfoBar(CreateSaveCardInfoBarMobile(
base::MakeUnique<AutofillSaveCardInfoBarDelegateMobile>( base::MakeUnique<AutofillSaveCardInfoBarDelegateMobile>(
true, card, std::move(legal_message), callback))); true, card, std::move(legal_message), callback, GetPrefs())));
} }
void AutofillClientIOS::ConfirmCreditCardFillAssist( void AutofillClientIOS::ConfirmCreditCardFillAssist(
......
...@@ -119353,6 +119353,20 @@ from previous Chrome versions. ...@@ -119353,6 +119353,20 @@ from previous Chrome versions.
<affected-histogram name="Autofill.SaveCreditCardPrompt"/> <affected-histogram name="Autofill.SaveCreditCardPrompt"/>
</histogram_suffixes> </histogram_suffixes>
<histogram_suffixes name="AutofillSaveCreditCardPromptPreviousUserDecision"
separator=".">
<suffix name="PreviouslyAccepted"
label="User had previously accepted save credit card prompt"/>
<suffix name="PreviouslyDenied"
label="User had previously denied save credit card prompt"/>
<affected-histogram name="Autofill.CreditCardInfoBar.Local"/>
<affected-histogram name="Autofill.CreditCardInfoBar.Server"/>
<affected-histogram name="Autofill.SaveCreditCardPrompt.Local.FirstShow"/>
<affected-histogram name="Autofill.SaveCreditCardPrompt.Local.Reshows"/>
<affected-histogram name="Autofill.SaveCreditCardPrompt.Upload.FirstShow"/>
<affected-histogram name="Autofill.SaveCreditCardPrompt.Upload.Reshows"/>
</histogram_suffixes>
<histogram_suffixes name="AutofillSaveCreditCardPromptShow" separator="."> <histogram_suffixes name="AutofillSaveCreditCardPromptShow" separator=".">
<suffix name="FirstShow" <suffix name="FirstShow"
label="first time prompt is shown for a single credit card submit"/> label="first time prompt is shown for a single credit card submit"/>
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