Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(203)

Side by Side Diff: chrome/browser/autofill/autofill_cc_import_confirmation_handler.cc

Issue 12378055: Make autofill stop depending on InfoBarService (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix tests Created 7 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
(Empty)
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "chrome/browser/autofill/autofill_cc_import_confirmation_handler.h"
6
7 #include "chrome/browser/autofill/autofill_metrics.h"
8 #include "chrome/browser/autofill/personal_data_manager.h"
9
10 namespace autofill {
11
12 AutofillCCImportConfirmationHandler::AutofillCCImportConfirmationHandler(
13 scoped_ptr<const CreditCard> credit_card,
14 PersonalDataManager* personal_data,
15 const AutofillMetrics* metric_logger)
16 : credit_card_(credit_card.Pass()),
17 personal_data_(personal_data),
18 metric_logger_(metric_logger),
19 had_user_interaction_(false) {}
20
21 AutofillCCImportConfirmationHandler::~AutofillCCImportConfirmationHandler() {
22 if (!had_user_interaction_)
Ilya Sherman 2013/03/05 04:37:39 nit: Still missing curly braces...
kaiwang 2013/03/05 18:38:16 Oops, forgot to commit
23 metric_logger_->LogCreditCardInfoBarMetric(
24 AutofillMetrics::INFOBAR_IGNORED);
25 }
26
27 void AutofillCCImportConfirmationHandler::DidShow() {
28 metric_logger_->LogCreditCardInfoBarMetric(AutofillMetrics::INFOBAR_SHOWN);
29 }
30
31 void AutofillCCImportConfirmationHandler::DidAccept() {
32 DCHECK(!had_user_interaction_);
33
34 personal_data_->SaveImportedCreditCard(*credit_card_);
35 metric_logger_->LogCreditCardInfoBarMetric(AutofillMetrics::INFOBAR_ACCEPTED);
36 had_user_interaction_ = true;
37 }
38
39 void AutofillCCImportConfirmationHandler::DidCancel() {
40 DCHECK(!had_user_interaction_);
41 metric_logger_->LogCreditCardInfoBarMetric(AutofillMetrics::INFOBAR_DENIED);
42 had_user_interaction_ = true;
43 }
44
45 void AutofillCCImportConfirmationHandler::DidDismiss() {
46 DCHECK(!had_user_interaction_);
47 metric_logger_->LogCreditCardInfoBarMetric(AutofillMetrics::INFOBAR_DENIED);
48 had_user_interaction_ = true;
49 }
50
51 } // namespace autofill
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698