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/thread_task_runner_handle.h" | 10 #include "base/thread_task_runner_handle.h" |
11 #include "chrome/browser/ui/autofill/autofill_dialog_types.h" | |
12 #include "chrome/browser/ui/autofill/create_card_unmask_prompt_view.h" | 11 #include "chrome/browser/ui/autofill/create_card_unmask_prompt_view.h" |
13 #include "chrome/browser/ui/views/autofill/decorated_textfield.h" | 12 #include "chrome/browser/ui/views/autofill/decorated_textfield.h" |
14 #include "chrome/browser/ui/views/autofill/tooltip_icon.h" | 13 #include "chrome/browser/ui/views/autofill/tooltip_icon.h" |
15 #include "chrome/grit/generated_resources.h" | 14 #include "chrome/grit/generated_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/web_modal/web_contents_modal_dialog_host.h" | 17 #include "components/web_modal/web_contents_modal_dialog_host.h" |
19 #include "components/web_modal/web_contents_modal_dialog_manager.h" | 18 #include "components/web_modal/web_contents_modal_dialog_manager.h" |
20 #include "components/web_modal/web_contents_modal_dialog_manager_delegate.h" | 19 #include "components/web_modal/web_contents_modal_dialog_manager_delegate.h" |
21 #include "grit/components_strings.h" | 20 #include "grit/components_strings.h" |
(...skipping 13 matching lines...) Expand all Loading... |
35 #include "ui/views/controls/image_view.h" | 34 #include "ui/views/controls/image_view.h" |
36 #include "ui/views/controls/label.h" | 35 #include "ui/views/controls/label.h" |
37 #include "ui/views/controls/link.h" | 36 #include "ui/views/controls/link.h" |
38 #include "ui/views/controls/throbber.h" | 37 #include "ui/views/controls/throbber.h" |
39 #include "ui/views/layout/box_layout.h" | 38 #include "ui/views/layout/box_layout.h" |
40 #include "ui/views/widget/widget.h" | 39 #include "ui/views/widget/widget.h" |
41 #include "ui/views/window/dialog_client_view.h" | 40 #include "ui/views/window/dialog_client_view.h" |
42 | 41 |
43 namespace autofill { | 42 namespace autofill { |
44 | 43 |
| 44 namespace { |
| 45 |
45 // 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 |
46 // dialog. | 47 // dialog. |
47 const int kEdgePadding = 19; | 48 const int kEdgePadding = 19; |
48 | 49 |
49 SkColor kGreyTextColor = SkColorSetRGB(0x64, 0x64, 0x64); | 50 SkColor kGreyTextColor = SkColorSetRGB(0x64, 0x64, 0x64); |
50 | 51 |
| 52 SkColor const kWarningColor = gfx::kGoogleRed700; |
| 53 SkColor const kLightShadingColor = SkColorSetARGB(7, 0, 0, 0); |
| 54 SkColor const kSubtleBorderColor = SkColorSetARGB(10, 0, 0, 0); |
| 55 |
| 56 } // namespace |
| 57 |
51 CardUnmaskPromptView* CreateCardUnmaskPromptView( | 58 CardUnmaskPromptView* CreateCardUnmaskPromptView( |
52 CardUnmaskPromptController* controller, | 59 CardUnmaskPromptController* controller, |
53 content::WebContents* web_contents) { | 60 content::WebContents* web_contents) { |
54 return new CardUnmaskPromptViews(controller, web_contents); | 61 return new CardUnmaskPromptViews(controller, web_contents); |
55 } | 62 } |
56 | 63 |
57 CardUnmaskPromptViews::CardUnmaskPromptViews( | 64 CardUnmaskPromptViews::CardUnmaskPromptViews( |
58 CardUnmaskPromptController* controller, | 65 CardUnmaskPromptController* controller, |
59 content::WebContents* web_contents) | 66 content::WebContents* web_contents) |
60 : controller_(controller), | 67 : controller_(controller), |
(...skipping 384 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
445 views::BoxLayout* temporary_error_layout = | 452 views::BoxLayout* temporary_error_layout = |
446 new views::BoxLayout(views::BoxLayout::kHorizontal, 0, 0, 4); | 453 new views::BoxLayout(views::BoxLayout::kHorizontal, 0, 0, 4); |
447 temporary_error->SetLayoutManager(temporary_error_layout); | 454 temporary_error->SetLayoutManager(temporary_error_layout); |
448 temporary_error_layout->set_cross_axis_alignment( | 455 temporary_error_layout->set_cross_axis_alignment( |
449 views::BoxLayout::CROSS_AXIS_ALIGNMENT_START); | 456 views::BoxLayout::CROSS_AXIS_ALIGNMENT_START); |
450 temporary_error->SetBorder(views::Border::CreateEmptyBorder(8, 0, 0, 0)); | 457 temporary_error->SetBorder(views::Border::CreateEmptyBorder(8, 0, 0, 0)); |
451 controls_container->AddChildView(temporary_error); | 458 controls_container->AddChildView(temporary_error); |
452 | 459 |
453 error_icon_ = new views::ImageView(); | 460 error_icon_ = new views::ImageView(); |
454 error_icon_->SetVisible(false); | 461 error_icon_->SetVisible(false); |
455 error_icon_->SetImage(gfx::CreateVectorIcon(gfx::VectorIconId::WARNING, 16, | 462 error_icon_->SetImage( |
456 gfx::kGoogleRed700)); | 463 gfx::CreateVectorIcon(gfx::VectorIconId::WARNING, 16, kWarningColor)); |
457 temporary_error->AddChildView(error_icon_); | 464 temporary_error->AddChildView(error_icon_); |
458 | 465 |
459 // Reserve vertical space for the error label, assuming it's one line. | 466 // Reserve vertical space for the error label, assuming it's one line. |
460 error_label_ = new views::Label(base::ASCIIToUTF16(" ")); | 467 error_label_ = new views::Label(base::ASCIIToUTF16(" ")); |
461 error_label_->SetHorizontalAlignment(gfx::ALIGN_LEFT); | 468 error_label_->SetHorizontalAlignment(gfx::ALIGN_LEFT); |
462 error_label_->SetEnabledColor(kWarningColor); | 469 error_label_->SetEnabledColor(kWarningColor); |
463 temporary_error->AddChildView(error_label_); | 470 temporary_error->AddChildView(error_label_); |
464 temporary_error_layout->SetFlexForView(error_label_, 1); | 471 temporary_error_layout->SetFlexForView(error_label_, 1); |
465 | 472 |
466 progress_overlay_ = new FadeOutView(); | 473 progress_overlay_ = new FadeOutView(); |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
519 views::View::OnPaint(canvas); | 526 views::View::OnPaint(canvas); |
520 canvas->Restore(); | 527 canvas->Restore(); |
521 } | 528 } |
522 | 529 |
523 void CardUnmaskPromptViews::FadeOutView::SetAlpha(uint8_t alpha) { | 530 void CardUnmaskPromptViews::FadeOutView::SetAlpha(uint8_t alpha) { |
524 alpha_ = alpha; | 531 alpha_ = alpha; |
525 SchedulePaint(); | 532 SchedulePaint(); |
526 } | 533 } |
527 | 534 |
528 } // namespace autofill | 535 } // namespace autofill |
OLD | NEW |