Chromium Code Reviews| Index: chrome/browser/ui/autofill/autofill_dialog_controller_impl.cc |
| diff --git a/chrome/browser/ui/autofill/autofill_dialog_controller_impl.cc b/chrome/browser/ui/autofill/autofill_dialog_controller_impl.cc |
| index e267becce5c28dc2c43b14e699a73f05453597c7..304e8eafa292d86517422cbacdcffebbb94bb114 100644 |
| --- a/chrome/browser/ui/autofill/autofill_dialog_controller_impl.cc |
| +++ b/chrome/browser/ui/autofill/autofill_dialog_controller_impl.cc |
| @@ -610,68 +610,10 @@ void AutofillDialogControllerImpl::TabActivated() { |
| } |
| } |
| -void AutofillDialogControllerImpl::OnAutocheckoutError() { |
| - DCHECK_EQ(AUTOCHECKOUT_IN_PROGRESS, autocheckout_state_); |
| - GetMetricLogger().LogAutocheckoutDuration( |
| - base::Time::Now() - autocheckout_started_timestamp_, |
| - AutofillMetrics::AUTOCHECKOUT_FAILED); |
| - SetAutocheckoutState(AUTOCHECKOUT_ERROR); |
| - autocheckout_started_timestamp_ = base::Time(); |
| -} |
| - |
| -void AutofillDialogControllerImpl::OnAutocheckoutSuccess() { |
| - DCHECK_EQ(AUTOCHECKOUT_IN_PROGRESS, autocheckout_state_); |
| - GetMetricLogger().LogAutocheckoutDuration( |
| - base::Time::Now() - autocheckout_started_timestamp_, |
| - AutofillMetrics::AUTOCHECKOUT_SUCCEEDED); |
| - SetAutocheckoutState(AUTOCHECKOUT_SUCCESS); |
| - autocheckout_started_timestamp_ = base::Time(); |
| -} |
| - |
| - |
| TestableAutofillDialogView* AutofillDialogControllerImpl::GetTestableView() { |
| return view_ ? view_->GetTestableView() : NULL; |
| } |
| -void AutofillDialogControllerImpl::AddAutocheckoutStep( |
| - AutocheckoutStepType step_type) { |
| - for (size_t i = 0; i < steps_.size(); ++i) { |
| - if (steps_[i].type() == step_type) |
| - return; |
| - } |
| - steps_.push_back( |
| - DialogAutocheckoutStep(step_type, AUTOCHECKOUT_STEP_UNSTARTED)); |
| -} |
| - |
| -void AutofillDialogControllerImpl::UpdateAutocheckoutStep( |
| - AutocheckoutStepType step_type, |
| - AutocheckoutStepStatus step_status) { |
| - ScopedViewUpdates updates(view_.get()); |
| - |
| - int total_steps = 0; |
| - int completed_steps = 0; |
| - for (size_t i = 0; i < steps_.size(); ++i) { |
| - ++total_steps; |
| - if (steps_[i].status() == AUTOCHECKOUT_STEP_COMPLETED) |
| - ++completed_steps; |
| - if (steps_[i].type() == step_type && steps_[i].status() != step_status) |
| - steps_[i] = DialogAutocheckoutStep(step_type, step_status); |
| - } |
| - if (view_) { |
| - view_->UpdateAutocheckoutStepsArea(); |
| - view_->UpdateProgressBar(1.0 * completed_steps / total_steps); |
| - } |
| -} |
| - |
| -std::vector<DialogAutocheckoutStep> |
| - AutofillDialogControllerImpl::CurrentAutocheckoutSteps() const { |
| - if (autocheckout_state_ != AUTOCHECKOUT_NOT_STARTED) |
| - return steps_; |
| - |
| - std::vector<DialogAutocheckoutStep> empty_steps; |
| - return empty_steps; |
| -} |
| - |
| //////////////////////////////////////////////////////////////////////////////// |
| // AutofillDialogViewDelegate implementation. |
| @@ -688,11 +630,6 @@ string16 AutofillDialogControllerImpl::CancelButtonText() const { |
| } |
| string16 AutofillDialogControllerImpl::ConfirmButtonText() const { |
| - if (autocheckout_state_ == AUTOCHECKOUT_ERROR) |
| - return l10n_util::GetStringUTF16(IDS_OK); |
| - if (autocheckout_state_ == AUTOCHECKOUT_SUCCESS) |
| - return l10n_util::GetStringUTF16(IDS_AUTOFILL_DIALOG_CONTINUE_BUTTON); |
| - |
| return l10n_util::GetStringUTF16(IsSubmitPausedOn(wallet::VERIFY_CVV) ? |
| IDS_AUTOFILL_DIALOG_VERIFY_BUTTON : IDS_AUTOFILL_DIALOG_SUBMIT_BUTTON); |
| } |
| @@ -706,7 +643,7 @@ string16 AutofillDialogControllerImpl::SaveLocallyTooltip() const { |
| } |
| string16 AutofillDialogControllerImpl::LegalDocumentsText() { |
| - if (!IsPayingWithWallet() || autocheckout_state_ != AUTOCHECKOUT_NOT_STARTED) |
| + if (!IsPayingWithWallet()) |
| return string16(); |
| EnsureLegalDocumentsText(); |
| @@ -760,11 +697,7 @@ bool AutofillDialogControllerImpl::ShouldOfferToSaveInChrome() const { |
| } |
| int AutofillDialogControllerImpl::GetDialogButtons() const { |
| - if (autocheckout_state_ == AUTOCHECKOUT_IN_PROGRESS) |
| - return ui::DIALOG_BUTTON_CANCEL; |
| - if (autocheckout_state_ == AUTOCHECKOUT_NOT_STARTED) |
| - return ui::DIALOG_BUTTON_OK | ui::DIALOG_BUTTON_CANCEL; |
| - return ui::DIALOG_BUTTON_OK; |
| + return ui::DIALOG_BUTTON_OK | ui::DIALOG_BUTTON_CANCEL; |
| } |
| bool AutofillDialogControllerImpl::IsDialogButtonEnabled( |
| @@ -773,14 +706,9 @@ bool AutofillDialogControllerImpl::IsDialogButtonEnabled( |
| if (IsSubmitPausedOn(wallet::VERIFY_CVV)) |
| return true; |
| - if (ShouldShowSpinner()) |
| + if (ShouldShowSpinner() || is_submitting_) |
| return false; |
| - if (is_submitting_) { |
| - return autocheckout_state_ == AUTOCHECKOUT_SUCCESS || |
| - autocheckout_state_ == AUTOCHECKOUT_ERROR; |
| - } |
| - |
| return true; |
| } |
| @@ -1222,15 +1150,7 @@ gfx::Image AutofillDialogControllerImpl::AccountChooserImage() { |
| } |
| bool AutofillDialogControllerImpl::ShouldShowDetailArea() const { |
| - // Hide the detail area when Autocheckout is running or there was an error (as |
| - // there's nothing they can do after an error but cancel). |
| - return autocheckout_state_ == AUTOCHECKOUT_NOT_STARTED; |
| -} |
| - |
| -bool AutofillDialogControllerImpl::ShouldShowProgressBar() const { |
| - // Show the progress bar while Autocheckout is running but hide it on errors, |
| - // as there's no use leaving it up if the flow has failed. |
| - return autocheckout_state_ == AUTOCHECKOUT_IN_PROGRESS; |
| + return true; |
| } |
|
Ilya Sherman
2013/08/27 18:57:57
Could you remove this method, or mark it as slated
Raman Kakilate
2013/08/27 21:52:59
Done.
|
| gfx::Image AutofillDialogControllerImpl::ButtonStripImage() const { |
| @@ -1795,9 +1715,6 @@ gfx::Image AutofillDialogControllerImpl::SplashPageImage() const { |
| void AutofillDialogControllerImpl::ViewClosed() { |
| GetManager()->RemoveObserver(this); |
| - // TODO(ahutter): Once a user can cancel Autocheckout mid-flow, log that |
| - // metric here. |
| - |
| // Called from here rather than in ~AutofillDialogControllerImpl as this |
| // relies on virtual methods that change to their base class in the dtor. |
| MaybeShowCreditCardBubble(); |
| @@ -1843,18 +1760,6 @@ std::vector<DialogNotification> AutofillDialogControllerImpl:: |
| l10n_util::GetStringUTF16(IDS_AUTOFILL_DIALOG_VERIFY_CVV))); |
| } |
| - if (autocheckout_state_ == AUTOCHECKOUT_ERROR) { |
| - notifications.push_back(DialogNotification( |
| - DialogNotification::AUTOCHECKOUT_ERROR, |
| - l10n_util::GetStringUTF16(IDS_AUTOFILL_DIALOG_AUTOCHECKOUT_ERROR))); |
| - } |
| - |
| - if (autocheckout_state_ == AUTOCHECKOUT_SUCCESS) { |
| - notifications.push_back(DialogNotification( |
| - DialogNotification::AUTOCHECKOUT_SUCCESS, |
| - l10n_util::GetStringUTF16(IDS_AUTOFILL_DIALOG_AUTOCHECKOUT_SUCCESS))); |
| - } |
| - |
| if (!wallet_server_validation_recoverable_) { |
| notifications.push_back(DialogNotification( |
| DialogNotification::REQUIRED_ACTION, |
| @@ -1946,43 +1851,16 @@ void AutofillDialogControllerImpl::OverlayButtonPressed() { |
| bool AutofillDialogControllerImpl::OnCancel() { |
| HidePopup(); |
| - if (autocheckout_state_ == AUTOCHECKOUT_NOT_STARTED && !is_submitting_) |
| + if (!is_submitting_) |
| LogOnCancelMetrics(); |
| - if (autocheckout_state_ == AUTOCHECKOUT_IN_PROGRESS) { |
| - GetMetricLogger().LogAutocheckoutDuration( |
| - base::Time::Now() - autocheckout_started_timestamp_, |
| - AutofillMetrics::AUTOCHECKOUT_CANCELLED); |
| - } |
| callback_.Run(NULL, std::string()); |
| return true; |
| } |
| bool AutofillDialogControllerImpl::OnAccept() { |
| - // If autocheckout has already started, the only thing left to do is to |
| - // close the dialog. |
| - if (autocheckout_state_ != AUTOCHECKOUT_NOT_STARTED) |
| - return true; |
| - |
| choose_another_instrument_or_address_ = false; |
| wallet_server_validation_recoverable_ = true; |
| HidePopup(); |
| - if (IsPayingWithWallet()) { |
| - bool has_proxy_card_step = false; |
| - for (size_t i = 0; i < steps_.size(); ++i) { |
| - if (steps_[i].type() == AUTOCHECKOUT_STEP_PROXY_CARD) { |
| - has_proxy_card_step = true; |
| - break; |
| - } |
| - } |
| - if (!has_proxy_card_step) { |
| - steps_.insert(steps_.begin(), |
| - DialogAutocheckoutStep(AUTOCHECKOUT_STEP_PROXY_CARD, |
| - AUTOCHECKOUT_STEP_UNSTARTED)); |
| - } |
| - } |
| - |
| - if (GetDialogType() == DIALOG_TYPE_AUTOCHECKOUT) |
| - DeemphasizeRenderView(); |
| SetIsSubmitting(true); |
| if (IsSubmitPausedOn(wallet::VERIFY_CVV)) { |
| @@ -2167,14 +2045,10 @@ void AutofillDialogControllerImpl::OnDidGetFullWallet( |
| full_wallet_ = full_wallet.Pass(); |
| if (full_wallet_->required_actions().empty()) { |
| - UpdateAutocheckoutStep(AUTOCHECKOUT_STEP_PROXY_CARD, |
| - AUTOCHECKOUT_STEP_COMPLETED); |
| FinishSubmit(); |
| return; |
| } |
| - SetAutocheckoutState(AUTOCHECKOUT_NOT_STARTED); |
| - |
| switch (full_wallet_->required_actions()[0]) { |
| case wallet::CHOOSE_ANOTHER_INSTRUMENT_OR_ADDRESS: |
| choose_another_instrument_or_address_ = true; |
| @@ -2345,7 +2219,7 @@ AutofillDialogControllerImpl::AutofillDialogControllerImpl( |
| profile_(Profile::FromBrowserContext(contents->GetBrowserContext())), |
| initial_user_state_(AutofillMetrics::DIALOG_USER_STATE_UNKNOWN), |
| dialog_type_(dialog_type), |
| - form_structure_(form_structure, std::string()), |
| + form_structure_(form_structure), |
| invoked_from_same_origin_(true), |
| source_url_(source_url), |
| callback_(callback), |
| @@ -2368,7 +2242,6 @@ AutofillDialogControllerImpl::AutofillDialogControllerImpl( |
| choose_another_instrument_or_address_(false), |
| wallet_server_validation_recoverable_(true), |
| data_was_passed_back_(false), |
| - autocheckout_state_(AUTOCHECKOUT_NOT_STARTED), |
| was_ui_latency_logged_(false), |
| deemphasized_render_view_(false) { |
| // TODO(estade): remove duplicates from |form_structure|? |
| @@ -2464,14 +2337,6 @@ void AutofillDialogControllerImpl::DisableWallet( |
| wallet_items_.reset(); |
| wallet_errors_.clear(); |
| GetWalletClient()->CancelRequests(); |
| - SetAutocheckoutState(AUTOCHECKOUT_NOT_STARTED); |
| - for (std::vector<DialogAutocheckoutStep>::iterator it = steps_.begin(); |
| - it != steps_.end(); ++it) { |
| - if (it->type() == AUTOCHECKOUT_STEP_PROXY_CARD) { |
| - steps_.erase(it); |
| - break; |
| - } |
| - } |
| SetIsSubmitting(false); |
| account_chooser_model_.SetHadWalletError(WalletErrorMessage(error_type)); |
| } |
| @@ -3051,11 +2916,6 @@ void AutofillDialogControllerImpl::SubmitWithWallet() { |
| DCHECK(!active_address_id_.empty()); |
| } |
| - if (GetDialogType() == DIALOG_TYPE_AUTOCHECKOUT) { |
| - DCHECK_EQ(AUTOCHECKOUT_NOT_STARTED, autocheckout_state_); |
| - SetAutocheckoutState(AUTOCHECKOUT_IN_PROGRESS); |
| - } |
| - |
| scoped_ptr<wallet::Instrument> inputted_instrument = |
| CreateTransientInstrument(); |
| if (inputted_instrument && IsEditingExistingData(SECTION_CC_BILLING)) { |
| @@ -3140,9 +3000,6 @@ void AutofillDialogControllerImpl::GetFullWallet() { |
| std::vector<wallet::WalletClient::RiskCapability> capabilities; |
| capabilities.push_back(wallet::WalletClient::VERIFY_CVC); |
| - UpdateAutocheckoutStep(AUTOCHECKOUT_STEP_PROXY_CARD, |
| - AUTOCHECKOUT_STEP_STARTED); |
| - |
| GetWalletClient()->GetFullWallet(wallet::WalletClient::FullWalletRequest( |
| active_instrument_id_, |
| active_address_id_, |
| @@ -3165,7 +3022,6 @@ void AutofillDialogControllerImpl::HandleSaveOrUpdateRequiredActions( |
| DisableWallet(wallet::WalletClient::UNKNOWN_ERROR); |
| } |
| } |
| - SetAutocheckoutState(AUTOCHECKOUT_NOT_STARTED); |
| SetIsSubmitting(false); |
| } |
| @@ -3234,14 +3090,6 @@ void AutofillDialogControllerImpl::FinishSubmit() { |
| !account_chooser_model_.WalletIsSelected()); |
| } |
| - if (GetDialogType() == DIALOG_TYPE_AUTOCHECKOUT) { |
| - // Stop observing PersonalDataManager to avoid the dialog redrawing while |
| - // in an Autocheckout flow. |
| - GetManager()->RemoveObserver(this); |
| - autocheckout_started_timestamp_ = base::Time::Now(); |
| - SetAutocheckoutState(AUTOCHECKOUT_IN_PROGRESS); |
| - } |
| - |
| LogOnFinishSubmitMetrics(); |
| // Callback should be called as late as possible. |
| @@ -3392,21 +3240,6 @@ void AutofillDialogControllerImpl::LogDialogLatencyToShow() { |
| was_ui_latency_logged_ = true; |
| } |
| -void AutofillDialogControllerImpl::SetAutocheckoutState( |
| - AutocheckoutState autocheckout_state) { |
| - if (autocheckout_state_ == autocheckout_state) |
| - return; |
| - |
| - autocheckout_state_ = autocheckout_state; |
| - if (view_) { |
| - ScopedViewUpdates updates(view_.get()); |
| - view_->UpdateDetailArea(); |
| - view_->UpdateButtonStrip(); |
| - view_->UpdateAutocheckoutStepsArea(); |
| - view_->UpdateNotificationArea(); |
| - } |
| -} |
| - |
| void AutofillDialogControllerImpl::DeemphasizeRenderView() { |
| web_contents()->GetRenderViewHost()->Send( |
| new ChromeViewMsg_SetVisuallyDeemphasized( |
| @@ -3477,12 +3310,6 @@ void AutofillDialogControllerImpl::MaybeShowCreditCardBubble() { |
| if (!full_wallet_ || !full_wallet_->billing_address()) |
| return; |
| - // Don't show GeneratedCardBubble if Autocheckout failed. |
| - if (GetDialogType() == DIALOG_TYPE_AUTOCHECKOUT && |
| - autocheckout_state_ != AUTOCHECKOUT_SUCCESS) { |
| - return; |
| - } |
| - |
| base::string16 backing_last_four; |
| if (ActiveInstrument()) { |
| backing_last_four = ActiveInstrument()->TypeAndLastFourDigits(); |