| 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/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
| 9 #include "chrome/browser/ui/autofill/autofill_dialog_types.h" | 9 #include "chrome/browser/ui/autofill/autofill_dialog_types.h" |
| 10 #include "chrome/browser/ui/autofill/card_unmask_prompt_controller.h" | 10 #include "chrome/browser/ui/autofill/card_unmask_prompt_controller.h" |
| 11 #include "chrome/browser/ui/views/autofill/decorated_textfield.h" | 11 #include "chrome/browser/ui/views/autofill/decorated_textfield.h" |
| 12 #include "chrome/browser/ui/views/autofill/tooltip_icon.h" | 12 #include "chrome/browser/ui/views/autofill/tooltip_icon.h" |
| 13 #include "chrome/grit/generated_resources.h" | 13 #include "chrome/grit/generated_resources.h" |
| 14 #include "components/constrained_window/constrained_window_views.h" | 14 #include "components/constrained_window/constrained_window_views.h" |
| 15 #include "components/web_modal/web_contents_modal_dialog_host.h" | 15 #include "components/web_modal/web_contents_modal_dialog_host.h" |
| 16 #include "components/web_modal/web_contents_modal_dialog_manager.h" | 16 #include "components/web_modal/web_contents_modal_dialog_manager.h" |
| 17 #include "components/web_modal/web_contents_modal_dialog_manager_delegate.h" | 17 #include "components/web_modal/web_contents_modal_dialog_manager_delegate.h" |
| 18 #include "grit/theme_resources.h" | 18 #include "grit/theme_resources.h" |
| 19 #include "third_party/skia/include/core/SkColor.h" | 19 #include "third_party/skia/include/core/SkColor.h" |
| 20 #include "ui/base/l10n/l10n_util.h" | 20 #include "ui/base/l10n/l10n_util.h" |
| 21 #include "ui/base/resource/resource_bundle.h" | 21 #include "ui/base/resource/resource_bundle.h" |
| 22 #include "ui/compositor/paint_context.h" |
| 22 #include "ui/gfx/canvas.h" | 23 #include "ui/gfx/canvas.h" |
| 23 #include "ui/views/background.h" | 24 #include "ui/views/background.h" |
| 24 #include "ui/views/controls/button/checkbox.h" | 25 #include "ui/views/controls/button/checkbox.h" |
| 25 #include "ui/views/controls/combobox/combobox.h" | 26 #include "ui/views/controls/combobox/combobox.h" |
| 26 #include "ui/views/controls/image_view.h" | 27 #include "ui/views/controls/image_view.h" |
| 27 #include "ui/views/controls/label.h" | 28 #include "ui/views/controls/label.h" |
| 28 #include "ui/views/controls/throbber.h" | 29 #include "ui/views/controls/throbber.h" |
| 29 #include "ui/views/layout/box_layout.h" | 30 #include "ui/views/layout/box_layout.h" |
| 30 #include "ui/views/widget/widget.h" | 31 #include "ui/views/widget/widget.h" |
| 31 #include "ui/views/window/dialog_client_view.h" | 32 #include "ui/views/window/dialog_client_view.h" |
| (...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 453 GetWidget()->Close(); | 454 GetWidget()->Close(); |
| 454 } | 455 } |
| 455 | 456 |
| 456 CardUnmaskPromptViews::FadeOutView::FadeOutView() | 457 CardUnmaskPromptViews::FadeOutView::FadeOutView() |
| 457 : fade_everything_(false), opacity_(1.0) { | 458 : fade_everything_(false), opacity_(1.0) { |
| 458 } | 459 } |
| 459 CardUnmaskPromptViews::FadeOutView::~FadeOutView() { | 460 CardUnmaskPromptViews::FadeOutView::~FadeOutView() { |
| 460 } | 461 } |
| 461 | 462 |
| 462 void CardUnmaskPromptViews::FadeOutView::PaintChildren( | 463 void CardUnmaskPromptViews::FadeOutView::PaintChildren( |
| 463 const PaintContext& context) { | 464 const ui::PaintContext& context) { |
| 464 if (opacity_ > 0.99) | 465 if (opacity_ > 0.99) |
| 465 return views::View::PaintChildren(context); | 466 return views::View::PaintChildren(context); |
| 466 | 467 |
| 467 gfx::Canvas* canvas = context.canvas(); | 468 gfx::Canvas* canvas = context.canvas(); |
| 468 canvas->SaveLayerAlpha(0xff * opacity_); | 469 canvas->SaveLayerAlpha(0xff * opacity_); |
| 469 views::View::PaintChildren(context); | 470 views::View::PaintChildren(context); |
| 470 canvas->Restore(); | 471 canvas->Restore(); |
| 471 } | 472 } |
| 472 | 473 |
| 473 void CardUnmaskPromptViews::FadeOutView::OnPaint(gfx::Canvas* canvas) { | 474 void CardUnmaskPromptViews::FadeOutView::OnPaint(gfx::Canvas* canvas) { |
| 474 if (!fade_everything_ || opacity_ > 0.99) | 475 if (!fade_everything_ || opacity_ > 0.99) |
| 475 return views::View::OnPaint(canvas); | 476 return views::View::OnPaint(canvas); |
| 476 | 477 |
| 477 canvas->SaveLayerAlpha(0xff * opacity_); | 478 canvas->SaveLayerAlpha(0xff * opacity_); |
| 478 views::View::OnPaint(canvas); | 479 views::View::OnPaint(canvas); |
| 479 canvas->Restore(); | 480 canvas->Restore(); |
| 480 } | 481 } |
| 481 | 482 |
| 482 void CardUnmaskPromptViews::FadeOutView::SetOpacity(double opacity) { | 483 void CardUnmaskPromptViews::FadeOutView::SetOpacity(double opacity) { |
| 483 opacity_ = opacity; | 484 opacity_ = opacity; |
| 484 SchedulePaint(); | 485 SchedulePaint(); |
| 485 } | 486 } |
| 486 | 487 |
| 487 } // namespace autofill | 488 } // namespace autofill |
| OLD | NEW |