| 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/compositing_recorder.h" |
| 22 #include "ui/compositor/paint_context.h" | 23 #include "ui/compositor/paint_context.h" |
| 23 #include "ui/gfx/canvas.h" | 24 #include "ui/gfx/canvas.h" |
| 24 #include "ui/views/background.h" | 25 #include "ui/views/background.h" |
| 25 #include "ui/views/controls/button/checkbox.h" | 26 #include "ui/views/controls/button/checkbox.h" |
| 26 #include "ui/views/controls/combobox/combobox.h" | 27 #include "ui/views/controls/combobox/combobox.h" |
| 27 #include "ui/views/controls/image_view.h" | 28 #include "ui/views/controls/image_view.h" |
| 28 #include "ui/views/controls/label.h" | 29 #include "ui/views/controls/label.h" |
| 29 #include "ui/views/controls/throbber.h" | 30 #include "ui/views/controls/throbber.h" |
| 30 #include "ui/views/layout/box_layout.h" | 31 #include "ui/views/layout/box_layout.h" |
| 31 #include "ui/views/widget/widget.h" | 32 #include "ui/views/widget/widget.h" |
| (...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 458 : fade_everything_(false), opacity_(1.0) { | 459 : fade_everything_(false), opacity_(1.0) { |
| 459 } | 460 } |
| 460 CardUnmaskPromptViews::FadeOutView::~FadeOutView() { | 461 CardUnmaskPromptViews::FadeOutView::~FadeOutView() { |
| 461 } | 462 } |
| 462 | 463 |
| 463 void CardUnmaskPromptViews::FadeOutView::PaintChildren( | 464 void CardUnmaskPromptViews::FadeOutView::PaintChildren( |
| 464 const ui::PaintContext& context) { | 465 const ui::PaintContext& context) { |
| 465 if (opacity_ > 0.99) | 466 if (opacity_ > 0.99) |
| 466 return views::View::PaintChildren(context); | 467 return views::View::PaintChildren(context); |
| 467 | 468 |
| 468 gfx::Canvas* canvas = context.canvas(); | 469 ui::CompositingRecorder recorder(context, opacity_); |
| 469 canvas->SaveLayerAlpha(0xff * opacity_); | |
| 470 views::View::PaintChildren(context); | 470 views::View::PaintChildren(context); |
| 471 canvas->Restore(); | |
| 472 } | 471 } |
| 473 | 472 |
| 474 void CardUnmaskPromptViews::FadeOutView::OnPaint(gfx::Canvas* canvas) { | 473 void CardUnmaskPromptViews::FadeOutView::OnPaint(gfx::Canvas* canvas) { |
| 475 if (!fade_everything_ || opacity_ > 0.99) | 474 if (!fade_everything_ || opacity_ > 0.99) |
| 476 return views::View::OnPaint(canvas); | 475 return views::View::OnPaint(canvas); |
| 477 | 476 |
| 478 canvas->SaveLayerAlpha(0xff * opacity_); | 477 canvas->SaveLayerAlpha(0xff * opacity_); |
| 479 views::View::OnPaint(canvas); | 478 views::View::OnPaint(canvas); |
| 480 canvas->Restore(); | 479 canvas->Restore(); |
| 481 } | 480 } |
| 482 | 481 |
| 483 void CardUnmaskPromptViews::FadeOutView::SetOpacity(double opacity) { | 482 void CardUnmaskPromptViews::FadeOutView::SetOpacity(double opacity) { |
| 484 opacity_ = opacity; | 483 opacity_ = opacity; |
| 485 SchedulePaint(); | 484 SchedulePaint(); |
| 486 } | 485 } |
| 487 | 486 |
| 488 } // namespace autofill | 487 } // namespace autofill |
| OLD | NEW |