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 1012 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1023 } | 1023 } |
| 1024 | 1024 |
| 1025 void AutofillDialogControllerImpl::OnDidGetFullWallet( | 1025 void AutofillDialogControllerImpl::OnDidGetFullWallet( |
| 1026 scoped_ptr<wallet::FullWallet> full_wallet) { | 1026 scoped_ptr<wallet::FullWallet> full_wallet) { |
| 1027 NOTIMPLEMENTED(); | 1027 NOTIMPLEMENTED(); |
| 1028 WalletRequestCompleted(true); | 1028 WalletRequestCompleted(true); |
| 1029 } | 1029 } |
| 1030 | 1030 |
| 1031 void AutofillDialogControllerImpl::OnDidGetWalletItems( | 1031 void AutofillDialogControllerImpl::OnDidGetWalletItems( |
| 1032 scoped_ptr<wallet::WalletItems> wallet_items) { | 1032 scoped_ptr<wallet::WalletItems> wallet_items) { |
| 1033 if (!wallet_items_ && wallet_items) { | |
|
Dan Beam
2013/03/12 02:06:01
wallet_items will always be non-NULL here
| |
| 1034 // On the first successful response, log any relevant user type metrics. | |
| 1035 // Consider a user to be an Autofill user if the user has any credit cards | |
| 1036 // or addresses saved. Check that the item count is greater than 1 because | |
| 1037 // an "empty" menu still has the "add new" menu item. | |
| 1038 bool has_autofill_profiles = | |
| 1039 suggested_cc_.GetItemCount() > 1 || | |
| 1040 suggested_billing_.GetItemCount() > 1; | |
| 1041 AutofillMetrics::DialogUserTypeMetric user_type; | |
| 1042 if (SignedInState() == SIGNED_IN) { | |
| 1043 if (!wallet_items->instruments().empty()) | |
| 1044 user_type = AutofillMetrics::DIALOG_WALLET_USER_SIGNED_IN; | |
|
Dan Beam
2013/03/12 02:06:01
why are we not logging whether a user has both aut
| |
| 1045 else if (has_autofill_profiles) | |
| 1046 user_type = AutofillMetrics::DIALOG_AUTOFILL_USER_SIGNED_IN; | |
| 1047 else | |
| 1048 user_type = AutofillMetrics::DIALOG_NEW_USER_SIGNED_IN; | |
|
Dan Beam
2013/03/12 02:06:01
I think this is a little strange to assume a user
| |
| 1049 } else { | |
| 1050 if (has_autofill_profiles) | |
| 1051 user_type = AutofillMetrics::DIALOG_AUTOFILL_USER_NOT_SIGNED_IN; | |
| 1052 else | |
| 1053 user_type = AutofillMetrics::DIALOG_NEW_USER_NOT_SIGNED_IN; | |
| 1054 } | |
| 1055 metric_logger_.LogDialogUserType(dialog_type_, user_type); | |
|
Dan Beam
2013/03/12 02:06:01
if I were writing this it'd go something like:
| |
| 1056 } | |
| 1057 | |
| 1033 bool items_changed = !wallet_items_ || *wallet_items != *wallet_items_; | 1058 bool items_changed = !wallet_items_ || *wallet_items != *wallet_items_; |
| 1034 wallet_items_ = wallet_items.Pass(); | 1059 wallet_items_ = wallet_items.Pass(); |
| 1035 WalletRequestCompleted(true); | 1060 WalletRequestCompleted(true); |
| 1036 | 1061 |
| 1037 if (items_changed) { | 1062 if (items_changed) { |
| 1038 GenerateSuggestionsModels(); | 1063 GenerateSuggestionsModels(); |
| 1039 view_->ModelChanged(); | 1064 view_->ModelChanged(); |
| 1040 view_->UpdateAccountChooser(); | 1065 view_->UpdateAccountChooser(); |
| 1041 view_->UpdateNotificationArea(); | 1066 view_->UpdateNotificationArea(); |
| 1042 } | 1067 } |
| (...skipping 393 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1436 // If the user is editing or inputting data, ask the view. | 1461 // If the user is editing or inputting data, ask the view. |
| 1437 if (item_key.empty() || section_editing_state_[SECTION_SHIPPING]) | 1462 if (item_key.empty() || section_editing_state_[SECTION_SHIPPING]) |
| 1438 return view_->UseBillingForShipping(); | 1463 return view_->UseBillingForShipping(); |
| 1439 | 1464 |
| 1440 // Otherwise, the checkbox should be hidden so its state is irrelevant. | 1465 // Otherwise, the checkbox should be hidden so its state is irrelevant. |
| 1441 // Always use the shipping suggestion model. | 1466 // Always use the shipping suggestion model. |
| 1442 return false; | 1467 return false; |
| 1443 } | 1468 } |
| 1444 | 1469 |
| 1445 } // namespace autofill | 1470 } // namespace autofill |
| OLD | NEW |