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

Side by Side Diff: chrome/browser/ui/views/autofill/card_unmask_prompt_views.cc

Issue 1019143003: Fix crash when user closes card unmasking dialog after verification (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "base/basictypes.h" 5 #include "base/basictypes.h"
6 #include "base/strings/utf_string_conversions.h" 6 #include "base/strings/utf_string_conversions.h"
7 #include "chrome/browser/ui/autofill/autofill_dialog_models.h" 7 #include "chrome/browser/ui/autofill/autofill_dialog_models.h"
8 #include "chrome/browser/ui/autofill/autofill_dialog_types.h" 8 #include "chrome/browser/ui/autofill/autofill_dialog_types.h"
9 #include "chrome/browser/ui/autofill/card_unmask_prompt_controller.h" 9 #include "chrome/browser/ui/autofill/card_unmask_prompt_controller.h"
10 #include "chrome/browser/ui/autofill/card_unmask_prompt_view.h" 10 #include "chrome/browser/ui/autofill/card_unmask_prompt_view.h"
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
51 explicit CardUnmaskPromptViews(CardUnmaskPromptController* controller) 51 explicit CardUnmaskPromptViews(CardUnmaskPromptController* controller)
52 : controller_(controller), 52 : controller_(controller),
53 main_contents_(nullptr), 53 main_contents_(nullptr),
54 permanent_error_label_(nullptr), 54 permanent_error_label_(nullptr),
55 cvc_input_(nullptr), 55 cvc_input_(nullptr),
56 month_input_(nullptr), 56 month_input_(nullptr),
57 year_input_(nullptr), 57 year_input_(nullptr),
58 error_label_(nullptr), 58 error_label_(nullptr),
59 storage_checkbox_(nullptr), 59 storage_checkbox_(nullptr),
60 progress_overlay_(nullptr), 60 progress_overlay_(nullptr),
61 progress_label_(nullptr) {} 61 progress_label_(nullptr),
62 weak_ptr_factory_(this) {}
62 63
63 ~CardUnmaskPromptViews() override { 64 ~CardUnmaskPromptViews() override {
64 if (controller_) 65 if (controller_)
65 controller_->OnUnmaskDialogClosed(); 66 controller_->OnUnmaskDialogClosed();
66 } 67 }
67 68
68 void Show() { 69 void Show() {
69 constrained_window::ShowWebModalDialogViews(this, 70 constrained_window::ShowWebModalDialogViews(this,
70 controller_->GetWebContents()); 71 controller_->GetWebContents());
71 } 72 }
(...skipping 11 matching lines...) Expand all
83 Layout(); 84 Layout();
84 } 85 }
85 86
86 void GotVerificationResult(const base::string16& error_message, 87 void GotVerificationResult(const base::string16& error_message,
87 bool allow_retry) override { 88 bool allow_retry) override {
88 if (error_message.empty()) { 89 if (error_message.empty()) {
89 progress_label_->SetText(l10n_util::GetStringUTF16( 90 progress_label_->SetText(l10n_util::GetStringUTF16(
90 IDS_AUTOFILL_CARD_UNMASK_VERIFICATION_SUCCESS)); 91 IDS_AUTOFILL_CARD_UNMASK_VERIFICATION_SUCCESS));
91 base::MessageLoop::current()->PostDelayedTask( 92 base::MessageLoop::current()->PostDelayedTask(
92 FROM_HERE, base::Bind(&CardUnmaskPromptViews::ClosePrompt, 93 FROM_HERE, base::Bind(&CardUnmaskPromptViews::ClosePrompt,
93 base::Unretained(this)), 94 weak_ptr_factory_.GetWeakPtr()),
94 base::TimeDelta::FromSeconds(1)); 95 base::TimeDelta::FromSeconds(1));
95 } else { 96 } else {
96 // TODO(estade): it's somewhat jarring when the error comes back too 97 // TODO(estade): it's somewhat jarring when the error comes back too
97 // quickly. 98 // quickly.
98 progress_overlay_->SetVisible(false); 99 progress_overlay_->SetVisible(false);
99 100
100 if (allow_retry) { 101 if (allow_retry) {
101 SetInputsEnabled(true); 102 SetInputsEnabled(true);
102 103
103 // If there is more than one input showing, don't mark anything as 104 // If there is more than one input showing, don't mark anything as
(...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after
412 YearComboboxModel year_combobox_model_; 413 YearComboboxModel year_combobox_model_;
413 414
414 // The error label for most errors, which lives beneath the inputs. 415 // The error label for most errors, which lives beneath the inputs.
415 views::Label* error_label_; 416 views::Label* error_label_;
416 417
417 views::Checkbox* storage_checkbox_; 418 views::Checkbox* storage_checkbox_;
418 419
419 views::View* progress_overlay_; 420 views::View* progress_overlay_;
420 views::Label* progress_label_; 421 views::Label* progress_label_;
421 422
423 base::WeakPtrFactory<CardUnmaskPromptViews> weak_ptr_factory_;
424
422 DISALLOW_COPY_AND_ASSIGN(CardUnmaskPromptViews); 425 DISALLOW_COPY_AND_ASSIGN(CardUnmaskPromptViews);
423 }; 426 };
424 427
425 } // namespace 428 } // namespace
426 429
427 // static 430 // static
428 CardUnmaskPromptView* CardUnmaskPromptView::CreateAndShow( 431 CardUnmaskPromptView* CardUnmaskPromptView::CreateAndShow(
429 CardUnmaskPromptController* controller) { 432 CardUnmaskPromptController* controller) {
430 CardUnmaskPromptViews* view = new CardUnmaskPromptViews(controller); 433 CardUnmaskPromptViews* view = new CardUnmaskPromptViews(controller);
431 view->Show(); 434 view->Show();
432 return view; 435 return view;
433 } 436 }
434 437
435 } // namespace autofill 438 } // namespace autofill
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698