| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/views/autofill/card_unmask_prompt_views.h" | 5 #include "chrome/browser/ui/views/autofill/card_unmask_prompt_views.h" |
| 6 | 6 |
| 7 #include "base/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "base/location.h" |
| 9 #include "base/single_thread_task_runner.h" |
| 8 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| 11 #include "base/thread_task_runner_handle.h" |
| 9 #include "chrome/browser/ui/autofill/autofill_dialog_types.h" | 12 #include "chrome/browser/ui/autofill/autofill_dialog_types.h" |
| 10 #include "chrome/browser/ui/autofill/create_card_unmask_prompt_view.h" | 13 #include "chrome/browser/ui/autofill/create_card_unmask_prompt_view.h" |
| 11 #include "chrome/browser/ui/views/autofill/decorated_textfield.h" | 14 #include "chrome/browser/ui/views/autofill/decorated_textfield.h" |
| 12 #include "chrome/browser/ui/views/autofill/tooltip_icon.h" | 15 #include "chrome/browser/ui/views/autofill/tooltip_icon.h" |
| 13 #include "chrome/grit/generated_resources.h" | 16 #include "chrome/grit/generated_resources.h" |
| 14 #include "components/autofill/core/browser/ui/card_unmask_prompt_controller.h" | 17 #include "components/autofill/core/browser/ui/card_unmask_prompt_controller.h" |
| 15 #include "components/constrained_window/constrained_window_views.h" | 18 #include "components/constrained_window/constrained_window_views.h" |
| 16 #include "components/web_modal/web_contents_modal_dialog_host.h" | 19 #include "components/web_modal/web_contents_modal_dialog_host.h" |
| 17 #include "components/web_modal/web_contents_modal_dialog_manager.h" | 20 #include "components/web_modal/web_contents_modal_dialog_manager.h" |
| 18 #include "components/web_modal/web_contents_modal_dialog_manager_delegate.h" | 21 #include "components/web_modal/web_contents_modal_dialog_manager_delegate.h" |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 } | 100 } |
| 98 | 101 |
| 99 void CardUnmaskPromptViews::GotVerificationResult( | 102 void CardUnmaskPromptViews::GotVerificationResult( |
| 100 const base::string16& error_message, | 103 const base::string16& error_message, |
| 101 bool allow_retry) { | 104 bool allow_retry) { |
| 102 progress_throbber_->Stop(); | 105 progress_throbber_->Stop(); |
| 103 if (error_message.empty()) { | 106 if (error_message.empty()) { |
| 104 progress_label_->SetText(l10n_util::GetStringUTF16( | 107 progress_label_->SetText(l10n_util::GetStringUTF16( |
| 105 IDS_AUTOFILL_CARD_UNMASK_VERIFICATION_SUCCESS)); | 108 IDS_AUTOFILL_CARD_UNMASK_VERIFICATION_SUCCESS)); |
| 106 progress_throbber_->SetChecked(true); | 109 progress_throbber_->SetChecked(true); |
| 107 base::MessageLoop::current()->PostDelayedTask( | 110 base::ThreadTaskRunnerHandle::Get()->PostDelayedTask( |
| 108 FROM_HERE, base::Bind(&CardUnmaskPromptViews::ClosePrompt, | 111 FROM_HERE, base::Bind(&CardUnmaskPromptViews::ClosePrompt, |
| 109 weak_ptr_factory_.GetWeakPtr()), | 112 weak_ptr_factory_.GetWeakPtr()), |
| 110 controller_->GetSuccessMessageDuration()); | 113 controller_->GetSuccessMessageDuration()); |
| 111 } else { | 114 } else { |
| 112 // TODO(estade): it's somewhat jarring when the error comes back too | 115 // TODO(estade): it's somewhat jarring when the error comes back too |
| 113 // quickly. | 116 // quickly. |
| 114 overlay_animation_.Reset(); | 117 overlay_animation_.Reset(); |
| 115 if (storage_row_) | 118 if (storage_row_) |
| 116 storage_row_->SetAlpha(255); | 119 storage_row_->SetAlpha(255); |
| 117 progress_overlay_->SetVisible(false); | 120 progress_overlay_->SetVisible(false); |
| (...skipping 398 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 516 views::View::OnPaint(canvas); | 519 views::View::OnPaint(canvas); |
| 517 canvas->Restore(); | 520 canvas->Restore(); |
| 518 } | 521 } |
| 519 | 522 |
| 520 void CardUnmaskPromptViews::FadeOutView::SetAlpha(uint8_t alpha) { | 523 void CardUnmaskPromptViews::FadeOutView::SetAlpha(uint8_t alpha) { |
| 521 alpha_ = alpha; | 524 alpha_ = alpha; |
| 522 SchedulePaint(); | 525 SchedulePaint(); |
| 523 } | 526 } |
| 524 | 527 |
| 525 } // namespace autofill | 528 } // namespace autofill |
| OLD | NEW |