| 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/decorated_textfield.h" | |
| 13 #include "chrome/browser/ui/views/autofill/tooltip_icon.h" | 12 #include "chrome/browser/ui/views/autofill/tooltip_icon.h" |
| 14 #include "chrome/grit/generated_resources.h" | 13 #include "chrome/grit/generated_resources.h" |
| 15 #include "chrome/grit/theme_resources.h" | 14 #include "chrome/grit/theme_resources.h" |
| 16 #include "components/autofill/core/browser/ui/card_unmask_prompt_controller.h" | 15 #include "components/autofill/core/browser/ui/card_unmask_prompt_controller.h" |
| 17 #include "components/constrained_window/constrained_window_views.h" | 16 #include "components/constrained_window/constrained_window_views.h" |
| 18 #include "components/strings/grit/components_strings.h" | 17 #include "components/strings/grit/components_strings.h" |
| 19 #include "components/web_modal/web_contents_modal_dialog_host.h" | 18 #include "components/web_modal/web_contents_modal_dialog_host.h" |
| 20 #include "components/web_modal/web_contents_modal_dialog_manager.h" | 19 #include "components/web_modal/web_contents_modal_dialog_manager.h" |
| 21 #include "components/web_modal/web_contents_modal_dialog_manager_delegate.h" | 20 #include "components/web_modal/web_contents_modal_dialog_manager_delegate.h" |
| 22 #include "third_party/skia/include/core/SkColor.h" | 21 #include "third_party/skia/include/core/SkColor.h" |
| 23 #include "ui/base/l10n/l10n_util.h" | 22 #include "ui/base/l10n/l10n_util.h" |
| 24 #include "ui/base/resource/resource_bundle.h" | 23 #include "ui/base/resource/resource_bundle.h" |
| 25 #include "ui/compositor/compositing_recorder.h" | 24 #include "ui/compositor/compositing_recorder.h" |
| 26 #include "ui/gfx/canvas.h" | 25 #include "ui/gfx/canvas.h" |
| 27 #include "ui/gfx/color_palette.h" | 26 #include "ui/gfx/color_palette.h" |
| 28 #include "ui/gfx/geometry/safe_integer_conversions.h" | 27 #include "ui/gfx/geometry/safe_integer_conversions.h" |
| 29 #include "ui/gfx/paint_vector_icon.h" | 28 #include "ui/gfx/paint_vector_icon.h" |
| 30 #include "ui/gfx/vector_icons_public.h" | 29 #include "ui/gfx/vector_icons_public.h" |
| 31 #include "ui/views/background.h" | 30 #include "ui/views/background.h" |
| 32 #include "ui/views/controls/button/checkbox.h" | 31 #include "ui/views/controls/button/checkbox.h" |
| 33 #include "ui/views/controls/combobox/combobox.h" | 32 #include "ui/views/controls/combobox/combobox.h" |
| 34 #include "ui/views/controls/image_view.h" | 33 #include "ui/views/controls/image_view.h" |
| 35 #include "ui/views/controls/label.h" | 34 #include "ui/views/controls/label.h" |
| 36 #include "ui/views/controls/link.h" | 35 #include "ui/views/controls/link.h" |
| 36 #include "ui/views/controls/textfield/textfield.h" |
| 37 #include "ui/views/controls/throbber.h" | 37 #include "ui/views/controls/throbber.h" |
| 38 #include "ui/views/layout/box_layout.h" | 38 #include "ui/views/layout/box_layout.h" |
| 39 #include "ui/views/widget/widget.h" | 39 #include "ui/views/widget/widget.h" |
| 40 #include "ui/views/window/dialog_client_view.h" | 40 #include "ui/views/window/dialog_client_view.h" |
| 41 | 41 |
| 42 namespace autofill { | 42 namespace autofill { |
| 43 | 43 |
| 44 namespace { | 44 namespace { |
| 45 | 45 |
| 46 // The number of pixels of blank space on the outer horizontal edges of the | 46 // The number of pixels of blank space on the outer horizontal edges of the |
| (...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 425 year_input_ = new views::Combobox(&year_combobox_model_); | 425 year_input_ = new views::Combobox(&year_combobox_model_); |
| 426 year_input_->set_listener(this); | 426 year_input_->set_listener(this); |
| 427 input_row_->AddChildView(year_input_); | 427 input_row_->AddChildView(year_input_); |
| 428 input_row_->AddChildView(new views::Label(base::ASCIIToUTF16(" "))); | 428 input_row_->AddChildView(new views::Label(base::ASCIIToUTF16(" "))); |
| 429 // Hide all of the above as appropriate. | 429 // Hide all of the above as appropriate. |
| 430 if (!controller_->ShouldRequestExpirationDate()) { | 430 if (!controller_->ShouldRequestExpirationDate()) { |
| 431 for (int i = 0; i < input_row_->child_count(); ++i) | 431 for (int i = 0; i < input_row_->child_count(); ++i) |
| 432 input_row_->child_at(i)->SetVisible(false); | 432 input_row_->child_at(i)->SetVisible(false); |
| 433 } | 433 } |
| 434 | 434 |
| 435 cvc_input_ = new DecoratedTextfield( | 435 cvc_input_ = new views::Textfield(); |
| 436 base::string16(), | 436 cvc_input_->set_placeholder_text( |
| 437 l10n_util::GetStringUTF16(IDS_AUTOFILL_DIALOG_PLACEHOLDER_CVC), this); | 437 l10n_util::GetStringUTF16(IDS_AUTOFILL_DIALOG_PLACEHOLDER_CVC)); |
| 438 cvc_input_->set_controller(this); |
| 438 cvc_input_->set_default_width_in_chars(8); | 439 cvc_input_->set_default_width_in_chars(8); |
| 439 input_row_->AddChildView(cvc_input_); | 440 input_row_->AddChildView(cvc_input_); |
| 440 | 441 |
| 441 views::ImageView* cvc_image = new views::ImageView(); | 442 views::ImageView* cvc_image = new views::ImageView(); |
| 442 cvc_image->SetImage(rb.GetImageSkiaNamed(controller_->GetCvcImageRid())); | 443 cvc_image->SetImage(rb.GetImageSkiaNamed(controller_->GetCvcImageRid())); |
| 443 input_row_->AddChildView(cvc_image); | 444 input_row_->AddChildView(cvc_image); |
| 444 | 445 |
| 445 views::View* temporary_error = new views::View(); | 446 views::View* temporary_error = new views::View(); |
| 446 views::BoxLayout* temporary_error_layout = | 447 views::BoxLayout* temporary_error_layout = |
| 447 new views::BoxLayout(views::BoxLayout::kHorizontal, 0, 0, 4); | 448 new views::BoxLayout(views::BoxLayout::kHorizontal, 0, 0, 4); |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 520 views::View::OnPaint(canvas); | 521 views::View::OnPaint(canvas); |
| 521 canvas->Restore(); | 522 canvas->Restore(); |
| 522 } | 523 } |
| 523 | 524 |
| 524 void CardUnmaskPromptViews::FadeOutView::SetAlpha(uint8_t alpha) { | 525 void CardUnmaskPromptViews::FadeOutView::SetAlpha(uint8_t alpha) { |
| 525 alpha_ = alpha; | 526 alpha_ = alpha; |
| 526 SchedulePaint(); | 527 SchedulePaint(); |
| 527 } | 528 } |
| 528 | 529 |
| 529 } // namespace autofill | 530 } // namespace autofill |
| OLD | NEW |