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/location.h" | 7 #include "base/location.h" |
8 #include "base/single_thread_task_runner.h" | 8 #include "base/single_thread_task_runner.h" |
9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 #include "base/threading/thread_task_runner_handle.h" | 10 #include "base/threading/thread_task_runner_handle.h" |
11 #include "chrome/browser/ui/autofill/create_card_unmask_prompt_view.h" | 11 #include "chrome/browser/ui/autofill/create_card_unmask_prompt_view.h" |
12 #include "chrome/browser/ui/views/autofill/view_util.h" | |
12 #include "chrome/grit/generated_resources.h" | 13 #include "chrome/grit/generated_resources.h" |
13 #include "chrome/grit/theme_resources.h" | 14 #include "chrome/grit/theme_resources.h" |
14 #include "components/autofill/core/browser/ui/card_unmask_prompt_controller.h" | 15 #include "components/autofill/core/browser/ui/card_unmask_prompt_controller.h" |
15 #include "components/constrained_window/constrained_window_views.h" | 16 #include "components/constrained_window/constrained_window_views.h" |
16 #include "components/strings/grit/components_strings.h" | 17 #include "components/strings/grit/components_strings.h" |
17 #include "components/web_modal/web_contents_modal_dialog_host.h" | 18 #include "components/web_modal/web_contents_modal_dialog_host.h" |
18 #include "components/web_modal/web_contents_modal_dialog_manager.h" | 19 #include "components/web_modal/web_contents_modal_dialog_manager.h" |
19 #include "components/web_modal/web_contents_modal_dialog_manager_delegate.h" | 20 #include "components/web_modal/web_contents_modal_dialog_manager_delegate.h" |
20 #include "third_party/skia/include/core/SkColor.h" | 21 #include "third_party/skia/include/core/SkColor.h" |
21 #include "ui/base/l10n/l10n_util.h" | 22 #include "ui/base/l10n/l10n_util.h" |
(...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
429 year_input_ = new views::Combobox(&year_combobox_model_); | 430 year_input_ = new views::Combobox(&year_combobox_model_); |
430 year_input_->set_listener(this); | 431 year_input_->set_listener(this); |
431 input_row_->AddChildView(year_input_); | 432 input_row_->AddChildView(year_input_); |
432 input_row_->AddChildView(new views::Label(base::ASCIIToUTF16(" "))); | 433 input_row_->AddChildView(new views::Label(base::ASCIIToUTF16(" "))); |
433 // Hide all of the above as appropriate. | 434 // Hide all of the above as appropriate. |
434 if (!controller_->ShouldRequestExpirationDate()) { | 435 if (!controller_->ShouldRequestExpirationDate()) { |
435 for (int i = 0; i < input_row_->child_count(); ++i) | 436 for (int i = 0; i < input_row_->child_count(); ++i) |
436 input_row_->child_at(i)->SetVisible(false); | 437 input_row_->child_at(i)->SetVisible(false); |
437 } | 438 } |
438 | 439 |
439 cvc_input_ = new views::Textfield(); | 440 cvc_input_ = autofill::CreateCvcTextfield(); |
Evan Stade
2017/04/12 15:21:31
aren't we already in the autofill:: namespace?
Jared Saul
2017/04/12 22:49:21
Yep; removed.
| |
440 cvc_input_->set_placeholder_text( | |
441 l10n_util::GetStringUTF16(IDS_AUTOFILL_DIALOG_PLACEHOLDER_CVC)); | |
442 cvc_input_->set_controller(this); | 441 cvc_input_->set_controller(this); |
443 cvc_input_->set_default_width_in_chars(8); | |
444 cvc_input_->SetTextInputType(ui::TextInputType::TEXT_INPUT_TYPE_NUMBER); | |
445 input_row_->AddChildView(cvc_input_); | 442 input_row_->AddChildView(cvc_input_); |
446 | 443 |
447 views::ImageView* cvc_image = new views::ImageView(); | 444 views::ImageView* cvc_image = new views::ImageView(); |
448 cvc_image->SetImage(rb.GetImageSkiaNamed(controller_->GetCvcImageRid())); | 445 cvc_image->SetImage(rb.GetImageSkiaNamed(controller_->GetCvcImageRid())); |
449 input_row_->AddChildView(cvc_image); | 446 input_row_->AddChildView(cvc_image); |
450 | 447 |
451 views::View* temporary_error = new views::View(); | 448 views::View* temporary_error = new views::View(); |
452 views::BoxLayout* temporary_error_layout = | 449 views::BoxLayout* temporary_error_layout = |
453 new views::BoxLayout(views::BoxLayout::kHorizontal, 0, 0, 4); | 450 new views::BoxLayout(views::BoxLayout::kHorizontal, 0, 0, 4); |
454 temporary_error->SetLayoutManager(temporary_error_layout); | 451 temporary_error->SetLayoutManager(temporary_error_layout); |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
526 views::View::OnPaint(canvas); | 523 views::View::OnPaint(canvas); |
527 canvas->Restore(); | 524 canvas->Restore(); |
528 } | 525 } |
529 | 526 |
530 void CardUnmaskPromptViews::FadeOutView::SetAlpha(uint8_t alpha) { | 527 void CardUnmaskPromptViews::FadeOutView::SetAlpha(uint8_t alpha) { |
531 alpha_ = alpha; | 528 alpha_ = alpha; |
532 SchedulePaint(); | 529 SchedulePaint(); |
533 } | 530 } |
534 | 531 |
535 } // namespace autofill | 532 } // namespace autofill |
OLD | NEW |