| 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/basictypes.h" | 7 #include "base/basictypes.h" |
| 8 #include "base/location.h" | 8 #include "base/location.h" |
| 9 #include "base/single_thread_task_runner.h" | 9 #include "base/single_thread_task_runner.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| 11 #include "base/thread_task_runner_handle.h" | 11 #include "base/thread_task_runner_handle.h" |
| 12 #include "chrome/browser/ui/autofill/autofill_dialog_types.h" | 12 #include "chrome/browser/ui/autofill/autofill_dialog_types.h" |
| 13 #include "chrome/browser/ui/autofill/create_card_unmask_prompt_view.h" | 13 #include "chrome/browser/ui/autofill/create_card_unmask_prompt_view.h" |
| 14 #include "chrome/browser/ui/views/autofill/decorated_textfield.h" | 14 #include "chrome/browser/ui/views/autofill/decorated_textfield.h" |
| 15 #include "chrome/browser/ui/views/autofill/tooltip_icon.h" | 15 #include "chrome/browser/ui/views/autofill/tooltip_icon.h" |
| 16 #include "chrome/grit/generated_resources.h" | 16 #include "chrome/grit/generated_resources.h" |
| 17 #include "components/autofill/core/browser/ui/card_unmask_prompt_controller.h" | 17 #include "components/autofill/core/browser/ui/card_unmask_prompt_controller.h" |
| 18 #include "components/constrained_window/constrained_window_views.h" | 18 #include "components/constrained_window/constrained_window_views.h" |
| 19 #include "components/web_modal/web_contents_modal_dialog_host.h" | 19 #include "components/web_modal/web_contents_modal_dialog_host.h" |
| 20 #include "components/web_modal/web_contents_modal_dialog_manager.h" | 20 #include "components/web_modal/web_contents_modal_dialog_manager.h" |
| 21 #include "components/web_modal/web_contents_modal_dialog_manager_delegate.h" | 21 #include "components/web_modal/web_contents_modal_dialog_manager_delegate.h" |
| 22 #include "grit/theme_resources.h" | 22 #include "grit/theme_resources.h" |
| 23 #include "third_party/skia/include/core/SkColor.h" | 23 #include "third_party/skia/include/core/SkColor.h" |
| 24 #include "ui/base/l10n/l10n_util.h" | 24 #include "ui/base/l10n/l10n_util.h" |
| 25 #include "ui/base/resource/resource_bundle.h" | 25 #include "ui/base/resource/resource_bundle.h" |
| 26 #include "ui/compositor/compositing_recorder.h" | 26 #include "ui/compositor/compositing_recorder.h" |
| 27 #include "ui/gfx/canvas.h" | 27 #include "ui/gfx/canvas.h" |
| 28 #include "ui/gfx/geometry/safe_integer_conversions.h" | 28 #include "ui/gfx/geometry/safe_integer_conversions.h" |
| 29 #include "ui/gfx/paint_vector_icon.h" |
| 30 #include "ui/gfx/vector_icons_public2.h" |
| 29 #include "ui/views/background.h" | 31 #include "ui/views/background.h" |
| 30 #include "ui/views/controls/button/checkbox.h" | 32 #include "ui/views/controls/button/checkbox.h" |
| 31 #include "ui/views/controls/combobox/combobox.h" | 33 #include "ui/views/controls/combobox/combobox.h" |
| 32 #include "ui/views/controls/image_view.h" | 34 #include "ui/views/controls/image_view.h" |
| 33 #include "ui/views/controls/label.h" | 35 #include "ui/views/controls/label.h" |
| 34 #include "ui/views/controls/link.h" | 36 #include "ui/views/controls/link.h" |
| 35 #include "ui/views/controls/throbber.h" | 37 #include "ui/views/controls/throbber.h" |
| 36 #include "ui/views/layout/box_layout.h" | 38 #include "ui/views/layout/box_layout.h" |
| 37 #include "ui/views/widget/widget.h" | 39 #include "ui/views/widget/widget.h" |
| 38 #include "ui/views/window/dialog_client_view.h" | 40 #include "ui/views/window/dialog_client_view.h" |
| (...skipping 407 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 446 views::BoxLayout* temporary_error_layout = | 448 views::BoxLayout* temporary_error_layout = |
| 447 new views::BoxLayout(views::BoxLayout::kHorizontal, 0, 0, 4); | 449 new views::BoxLayout(views::BoxLayout::kHorizontal, 0, 0, 4); |
| 448 temporary_error->SetLayoutManager(temporary_error_layout); | 450 temporary_error->SetLayoutManager(temporary_error_layout); |
| 449 temporary_error_layout->set_cross_axis_alignment( | 451 temporary_error_layout->set_cross_axis_alignment( |
| 450 views::BoxLayout::CROSS_AXIS_ALIGNMENT_START); | 452 views::BoxLayout::CROSS_AXIS_ALIGNMENT_START); |
| 451 temporary_error->SetBorder(views::Border::CreateEmptyBorder(8, 0, 0, 0)); | 453 temporary_error->SetBorder(views::Border::CreateEmptyBorder(8, 0, 0, 0)); |
| 452 controls_container->AddChildView(temporary_error); | 454 controls_container->AddChildView(temporary_error); |
| 453 | 455 |
| 454 error_icon_ = new views::ImageView(); | 456 error_icon_ = new views::ImageView(); |
| 455 error_icon_->SetVisible(false); | 457 error_icon_->SetVisible(false); |
| 456 error_icon_->SetImage(ui::ResourceBundle::GetSharedInstance() | 458 // TODO(estade): revisit this color. |
| 457 .GetImageNamed(IDR_ALERT_RED) | 459 error_icon_->SetImage(gfx::CreateVectorIcon(gfx::VectorIconId::WARNING, 16, |
| 458 .ToImageSkia()); | 460 SkColorSetRGB(0xDB, 0x44, 0x37))); |
| 459 temporary_error->AddChildView(error_icon_); | 461 temporary_error->AddChildView(error_icon_); |
| 460 | 462 |
| 461 // Reserve vertical space for the error label, assuming it's one line. | 463 // Reserve vertical space for the error label, assuming it's one line. |
| 462 error_label_ = new views::Label(base::ASCIIToUTF16(" ")); | 464 error_label_ = new views::Label(base::ASCIIToUTF16(" ")); |
| 463 error_label_->SetHorizontalAlignment(gfx::ALIGN_LEFT); | 465 error_label_->SetHorizontalAlignment(gfx::ALIGN_LEFT); |
| 464 error_label_->SetEnabledColor(kWarningColor); | 466 error_label_->SetEnabledColor(kWarningColor); |
| 465 temporary_error->AddChildView(error_label_); | 467 temporary_error->AddChildView(error_label_); |
| 466 temporary_error_layout->SetFlexForView(error_label_, 1); | 468 temporary_error_layout->SetFlexForView(error_label_, 1); |
| 467 | 469 |
| 468 progress_overlay_ = new FadeOutView(); | 470 progress_overlay_ = new FadeOutView(); |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 519 views::View::OnPaint(canvas); | 521 views::View::OnPaint(canvas); |
| 520 canvas->Restore(); | 522 canvas->Restore(); |
| 521 } | 523 } |
| 522 | 524 |
| 523 void CardUnmaskPromptViews::FadeOutView::SetAlpha(uint8_t alpha) { | 525 void CardUnmaskPromptViews::FadeOutView::SetAlpha(uint8_t alpha) { |
| 524 alpha_ = alpha; | 526 alpha_ = alpha; |
| 525 SchedulePaint(); | 527 SchedulePaint(); |
| 526 } | 528 } |
| 527 | 529 |
| 528 } // namespace autofill | 530 } // namespace autofill |
| OLD | NEW |