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 "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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
68 | 68 |
69 void DisableAndWaitForVerification() override { | 69 void DisableAndWaitForVerification() override { |
70 SetInputsEnabled(false); | 70 SetInputsEnabled(false); |
71 progress_overlay_->SetVisible(true); | 71 progress_overlay_->SetVisible(true); |
72 GetDialogClientView()->UpdateDialogButtons(); | 72 GetDialogClientView()->UpdateDialogButtons(); |
73 Layout(); | 73 Layout(); |
74 } | 74 } |
75 | 75 |
76 void GotVerificationResult(const base::string16& error_message, | 76 void GotVerificationResult(const base::string16& error_message, |
77 bool allow_retry) override { | 77 bool allow_retry) override { |
78 if (!error_message.empty()) { | 78 if (error_message.empty()) { |
Evan Stade
2015/03/09 18:06:56
this is a bug --- it was debugging code that slipp
| |
79 progress_label_->SetText(base::ASCIIToUTF16("Success!")); | 79 progress_label_->SetText(l10n_util::GetStringUTF16( |
80 IDS_AUTOFILL_CARD_UNMASK_VERIFICATION_SUCCESS)); | |
80 base::MessageLoop::current()->PostDelayedTask( | 81 base::MessageLoop::current()->PostDelayedTask( |
81 FROM_HERE, base::Bind(&CardUnmaskPromptViews::ClosePrompt, | 82 FROM_HERE, base::Bind(&CardUnmaskPromptViews::ClosePrompt, |
82 base::Unretained(this)), | 83 base::Unretained(this)), |
83 base::TimeDelta::FromSeconds(1)); | 84 base::TimeDelta::FromSeconds(1)); |
84 } else { | 85 } else { |
85 SetInputsEnabled(allow_retry); | 86 SetInputsEnabled(allow_retry); |
86 | 87 |
87 // If there is more than one input showing, don't mark anything as invalid | 88 // If there is more than one input showing, don't mark anything as invalid |
88 // since we don't know the location of the problem. | 89 // since we don't know the location of the problem. |
89 if (controller_->ShouldRequestExpirationDate()) | 90 if (controller_->ShouldRequestExpirationDate()) |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
165 return controller_->GetWindowTitle(); | 166 return controller_->GetWindowTitle(); |
166 } | 167 } |
167 | 168 |
168 void DeleteDelegate() override { delete this; } | 169 void DeleteDelegate() override { delete this; } |
169 | 170 |
170 int GetDialogButtons() const override { | 171 int GetDialogButtons() const override { |
171 return ui::DIALOG_BUTTON_OK | ui::DIALOG_BUTTON_CANCEL; | 172 return ui::DIALOG_BUTTON_OK | ui::DIALOG_BUTTON_CANCEL; |
172 } | 173 } |
173 | 174 |
174 base::string16 GetDialogButtonLabel(ui::DialogButton button) const override { | 175 base::string16 GetDialogButtonLabel(ui::DialogButton button) const override { |
175 // TODO(estade): fix this. | |
176 if (button == ui::DIALOG_BUTTON_OK) | 176 if (button == ui::DIALOG_BUTTON_OK) |
177 return base::ASCIIToUTF16("Verify"); | 177 return l10n_util::GetStringUTF16(IDS_AUTOFILL_CARD_UNMASK_CONFIRM_BUTTON); |
178 | 178 |
179 return DialogDelegateView::GetDialogButtonLabel(button); | 179 return DialogDelegateView::GetDialogButtonLabel(button); |
180 } | 180 } |
181 | 181 |
182 bool ShouldDefaultButtonBeBlue() const override { return true; } | 182 bool ShouldDefaultButtonBeBlue() const override { return true; } |
183 | 183 |
184 bool IsDialogButtonEnabled(ui::DialogButton button) const override { | 184 bool IsDialogButtonEnabled(ui::DialogButton button) const override { |
185 if (button == ui::DIALOG_BUTTON_CANCEL) | 185 if (button == ui::DIALOG_BUTTON_CANCEL) |
186 return true; | 186 return true; |
187 | 187 |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
293 new views::BoxLayout(views::BoxLayout::kVertical, 0, 0, 0); | 293 new views::BoxLayout(views::BoxLayout::kVertical, 0, 0, 0); |
294 progress_layout->set_main_axis_alignment( | 294 progress_layout->set_main_axis_alignment( |
295 views::BoxLayout::MAIN_AXIS_ALIGNMENT_CENTER); | 295 views::BoxLayout::MAIN_AXIS_ALIGNMENT_CENTER); |
296 progress_layout->set_cross_axis_alignment( | 296 progress_layout->set_cross_axis_alignment( |
297 views::BoxLayout::CROSS_AXIS_ALIGNMENT_CENTER); | 297 views::BoxLayout::CROSS_AXIS_ALIGNMENT_CENTER); |
298 progress_overlay_->SetLayoutManager(progress_layout); | 298 progress_overlay_->SetLayoutManager(progress_layout); |
299 | 299 |
300 progress_overlay_->SetVisible(false); | 300 progress_overlay_->SetVisible(false); |
301 AddChildView(progress_overlay_); | 301 AddChildView(progress_overlay_); |
302 | 302 |
303 progress_label_ = new views::Label(base::ASCIIToUTF16("Verifying...")); | 303 progress_label_ = new views::Label(l10n_util::GetStringUTF16( |
304 IDS_AUTOFILL_CARD_UNMASK_VERIFICATION_IN_PROGRESS)); | |
304 progress_overlay_->AddChildView(progress_label_); | 305 progress_overlay_->AddChildView(progress_label_); |
305 } | 306 } |
306 | 307 |
307 void ClosePrompt() { GetWidget()->Close(); } | 308 void ClosePrompt() { GetWidget()->Close(); } |
308 | 309 |
309 CardUnmaskPromptController* controller_; | 310 CardUnmaskPromptController* controller_; |
310 | 311 |
311 views::View* controls_container_; | 312 views::View* controls_container_; |
312 | 313 |
313 DecoratedTextfield* cvc_input_; | 314 DecoratedTextfield* cvc_input_; |
(...skipping 19 matching lines...) Expand all Loading... | |
333 | 334 |
334 // static | 335 // static |
335 CardUnmaskPromptView* CardUnmaskPromptView::CreateAndShow( | 336 CardUnmaskPromptView* CardUnmaskPromptView::CreateAndShow( |
336 CardUnmaskPromptController* controller) { | 337 CardUnmaskPromptController* controller) { |
337 CardUnmaskPromptViews* view = new CardUnmaskPromptViews(controller); | 338 CardUnmaskPromptViews* view = new CardUnmaskPromptViews(controller); |
338 view->Show(); | 339 view->Show(); |
339 return view; | 340 return view; |
340 } | 341 } |
341 | 342 |
342 } // namespace autofill | 343 } // namespace autofill |
OLD | NEW |