Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/ui/autofill/autofill_dialog_controller_impl.h" | 5 #include "chrome/browser/ui/autofill/autofill_dialog_controller_impl.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| (...skipping 1009 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1020 } | 1020 } |
| 1021 | 1021 |
| 1022 void AutofillDialogControllerImpl::OnDidGetFullWallet( | 1022 void AutofillDialogControllerImpl::OnDidGetFullWallet( |
| 1023 scoped_ptr<wallet::FullWallet> full_wallet) { | 1023 scoped_ptr<wallet::FullWallet> full_wallet) { |
| 1024 NOTIMPLEMENTED(); | 1024 NOTIMPLEMENTED(); |
| 1025 WalletRequestCompleted(true); | 1025 WalletRequestCompleted(true); |
| 1026 } | 1026 } |
| 1027 | 1027 |
| 1028 void AutofillDialogControllerImpl::OnDidGetWalletItems( | 1028 void AutofillDialogControllerImpl::OnDidGetWalletItems( |
| 1029 scoped_ptr<wallet::WalletItems> wallet_items) { | 1029 scoped_ptr<wallet::WalletItems> wallet_items) { |
| 1030 if (!wallet_items_ && wallet_items) { | |
|
Dan Beam
2013/03/07 17:16:50
I don't really know how you'd make this harder to
Dan Beam
2013/03/07 17:16:50
this currently assumes we don't re-request wallet
Ilya Sherman
2013/03/09 01:58:57
Do you have a suggestion on how to better hook thi
Dan Beam
2013/03/09 02:02:31
^ yes, something along these lines, or figure out
| |
| 1031 // On the first successful response, log any relevant user type metrics. | |
| 1032 // Consider a user to be an Autofill user if the user has any credit cards | |
| 1033 // or addresses saved. Check that the item count is greater than 1 because | |
| 1034 // an "empty" menu still has the "add new" menu item. | |
| 1035 bool has_autofill_profiles = | |
| 1036 suggested_cc_.GetItemCount() > 1 || | |
| 1037 suggested_billing_.GetItemCount() > 1; | |
|
Dan Beam
2013/03/07 17:16:50
what if there's a network error/wallet error/malfo
Ilya Sherman
2013/03/09 01:58:57
Then we won't get a stat for that user. Since thi
Dan Beam
2013/03/09 02:02:31
how do you know this will affect users equally? ca
| |
| 1038 AutofillMetrics::DialogUserTypeMetric user_type; | |
| 1039 if (SignedInState() == SIGNED_IN) { | |
| 1040 if (!wallet_items->instruments().empty()) | |
| 1041 user_type = AutofillMetrics::DIALOG_WALLET_USER_SIGNED_IN; | |
| 1042 else if (has_autofill_profiles) | |
| 1043 user_type = AutofillMetrics::DIALOG_AUTOFILL_USER_SIGNED_IN; | |
| 1044 else | |
| 1045 user_type = AutofillMetrics::DIALOG_NEW_USER_SIGNED_IN; | |
| 1046 } else { | |
| 1047 if (has_autofill_profiles) | |
| 1048 user_type = AutofillMetrics::DIALOG_AUTOFILL_USER_NOT_SIGNED_IN; | |
| 1049 else | |
| 1050 user_type = AutofillMetrics::DIALOG_NEW_USER_NOT_SIGNED_IN; | |
| 1051 } | |
| 1052 metric_logger_.LogDialogUserType(dialog_type_, user_type); | |
| 1053 } | |
| 1054 | |
| 1030 bool items_changed = !wallet_items_ || *wallet_items != *wallet_items_; | 1055 bool items_changed = !wallet_items_ || *wallet_items != *wallet_items_; |
| 1031 wallet_items_ = wallet_items.Pass(); | 1056 wallet_items_ = wallet_items.Pass(); |
| 1032 WalletRequestCompleted(true); | 1057 WalletRequestCompleted(true); |
| 1033 | 1058 |
| 1034 if (items_changed) { | 1059 if (items_changed) { |
| 1035 GenerateSuggestionsModels(); | 1060 GenerateSuggestionsModels(); |
| 1036 view_->ModelChanged(); | 1061 view_->ModelChanged(); |
| 1037 view_->UpdateAccountChooser(); | 1062 view_->UpdateAccountChooser(); |
| 1038 view_->UpdateNotificationArea(); | 1063 view_->UpdateNotificationArea(); |
| 1039 } | 1064 } |
| (...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1433 // If the user is editing or inputting data, ask the view. | 1458 // If the user is editing or inputting data, ask the view. |
| 1434 if (item_key.empty() || section_editing_state_[SECTION_SHIPPING]) | 1459 if (item_key.empty() || section_editing_state_[SECTION_SHIPPING]) |
| 1435 return view_->UseBillingForShipping(); | 1460 return view_->UseBillingForShipping(); |
| 1436 | 1461 |
| 1437 // Otherwise, the checkbox should be hidden so its state is irrelevant. | 1462 // Otherwise, the checkbox should be hidden so its state is irrelevant. |
| 1438 // Always use the shipping suggestion model. | 1463 // Always use the shipping suggestion model. |
| 1439 return false; | 1464 return false; |
| 1440 } | 1465 } |
| 1441 | 1466 |
| 1442 } // namespace autofill | 1467 } // namespace autofill |
| OLD | NEW |