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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
69 | 69 |
70 void DisableAndWaitForVerification() override { | 70 void DisableAndWaitForVerification() override { |
71 SetInputsEnabled(false); | 71 SetInputsEnabled(false); |
72 progress_overlay_->SetVisible(true); | 72 progress_overlay_->SetVisible(true); |
73 GetDialogClientView()->UpdateDialogButtons(); | 73 GetDialogClientView()->UpdateDialogButtons(); |
74 Layout(); | 74 Layout(); |
75 } | 75 } |
76 | 76 |
77 void GotVerificationResult(const base::string16& error_message, | 77 void GotVerificationResult(const base::string16& error_message, |
78 bool allow_retry) override { | 78 bool allow_retry) override { |
79 if (!error_message.empty()) { | 79 if (error_message.empty()) { |
80 progress_label_->SetText(base::ASCIIToUTF16("Success!")); | 80 progress_label_->SetText(l10n_util::GetStringUTF16( |
| 81 IDS_AUTOFILL_CARD_UNMASK_VERIFICATION_SUCCESS)); |
81 base::MessageLoop::current()->PostDelayedTask( | 82 base::MessageLoop::current()->PostDelayedTask( |
82 FROM_HERE, base::Bind(&CardUnmaskPromptViews::ClosePrompt, | 83 FROM_HERE, base::Bind(&CardUnmaskPromptViews::ClosePrompt, |
83 base::Unretained(this)), | 84 base::Unretained(this)), |
84 base::TimeDelta::FromSeconds(1)); | 85 base::TimeDelta::FromSeconds(1)); |
85 } else { | 86 } else { |
86 SetInputsEnabled(allow_retry); | 87 SetInputsEnabled(allow_retry); |
87 | 88 |
88 // If there is more than one input showing, don't mark anything as invalid | 89 // If there is more than one input showing, don't mark anything as invalid |
89 // since we don't know the location of the problem. | 90 // since we don't know the location of the problem. |
90 if (controller_->ShouldRequestExpirationDate()) | 91 if (controller_->ShouldRequestExpirationDate()) |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 return controller_->GetWindowTitle(); | 167 return controller_->GetWindowTitle(); |
167 } | 168 } |
168 | 169 |
169 void DeleteDelegate() override { delete this; } | 170 void DeleteDelegate() override { delete this; } |
170 | 171 |
171 int GetDialogButtons() const override { | 172 int GetDialogButtons() const override { |
172 return ui::DIALOG_BUTTON_OK | ui::DIALOG_BUTTON_CANCEL; | 173 return ui::DIALOG_BUTTON_OK | ui::DIALOG_BUTTON_CANCEL; |
173 } | 174 } |
174 | 175 |
175 base::string16 GetDialogButtonLabel(ui::DialogButton button) const override { | 176 base::string16 GetDialogButtonLabel(ui::DialogButton button) const override { |
176 // TODO(estade): fix this. | |
177 if (button == ui::DIALOG_BUTTON_OK) | 177 if (button == ui::DIALOG_BUTTON_OK) |
178 return base::ASCIIToUTF16("Verify"); | 178 return l10n_util::GetStringUTF16(IDS_AUTOFILL_CARD_UNMASK_CONFIRM_BUTTON); |
179 | 179 |
180 return DialogDelegateView::GetDialogButtonLabel(button); | 180 return DialogDelegateView::GetDialogButtonLabel(button); |
181 } | 181 } |
182 | 182 |
183 bool ShouldDefaultButtonBeBlue() const override { return true; } | 183 bool ShouldDefaultButtonBeBlue() const override { return true; } |
184 | 184 |
185 bool IsDialogButtonEnabled(ui::DialogButton button) const override { | 185 bool IsDialogButtonEnabled(ui::DialogButton button) const override { |
186 if (button == ui::DIALOG_BUTTON_CANCEL) | 186 if (button == ui::DIALOG_BUTTON_CANCEL) |
187 return true; | 187 return true; |
188 | 188 |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
307 new views::BoxLayout(views::BoxLayout::kVertical, 0, 0, 0); | 307 new views::BoxLayout(views::BoxLayout::kVertical, 0, 0, 0); |
308 progress_layout->set_main_axis_alignment( | 308 progress_layout->set_main_axis_alignment( |
309 views::BoxLayout::MAIN_AXIS_ALIGNMENT_CENTER); | 309 views::BoxLayout::MAIN_AXIS_ALIGNMENT_CENTER); |
310 progress_layout->set_cross_axis_alignment( | 310 progress_layout->set_cross_axis_alignment( |
311 views::BoxLayout::CROSS_AXIS_ALIGNMENT_CENTER); | 311 views::BoxLayout::CROSS_AXIS_ALIGNMENT_CENTER); |
312 progress_overlay_->SetLayoutManager(progress_layout); | 312 progress_overlay_->SetLayoutManager(progress_layout); |
313 | 313 |
314 progress_overlay_->SetVisible(false); | 314 progress_overlay_->SetVisible(false); |
315 AddChildView(progress_overlay_); | 315 AddChildView(progress_overlay_); |
316 | 316 |
317 progress_label_ = new views::Label(base::ASCIIToUTF16("Verifying...")); | 317 progress_label_ = new views::Label(l10n_util::GetStringUTF16( |
| 318 IDS_AUTOFILL_CARD_UNMASK_VERIFICATION_IN_PROGRESS)); |
318 progress_overlay_->AddChildView(progress_label_); | 319 progress_overlay_->AddChildView(progress_label_); |
319 } | 320 } |
320 | 321 |
321 void ClosePrompt() { GetWidget()->Close(); } | 322 void ClosePrompt() { GetWidget()->Close(); } |
322 | 323 |
323 CardUnmaskPromptController* controller_; | 324 CardUnmaskPromptController* controller_; |
324 | 325 |
325 views::View* controls_container_; | 326 views::View* controls_container_; |
326 | 327 |
327 DecoratedTextfield* cvc_input_; | 328 DecoratedTextfield* cvc_input_; |
(...skipping 19 matching lines...) Expand all Loading... |
347 | 348 |
348 // static | 349 // static |
349 CardUnmaskPromptView* CardUnmaskPromptView::CreateAndShow( | 350 CardUnmaskPromptView* CardUnmaskPromptView::CreateAndShow( |
350 CardUnmaskPromptController* controller) { | 351 CardUnmaskPromptController* controller) { |
351 CardUnmaskPromptViews* view = new CardUnmaskPromptViews(controller); | 352 CardUnmaskPromptViews* view = new CardUnmaskPromptViews(controller); |
352 view->Show(); | 353 view->Show(); |
353 return view; | 354 return view; |
354 } | 355 } |
355 | 356 |
356 } // namespace autofill | 357 } // namespace autofill |
OLD | NEW |