| 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" |
| (...skipping 486 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 497 GetWidget()->Close(); | 497 GetWidget()->Close(); |
| 498 } | 498 } |
| 499 | 499 |
| 500 CardUnmaskPromptViews::FadeOutView::FadeOutView() | 500 CardUnmaskPromptViews::FadeOutView::FadeOutView() |
| 501 : fade_everything_(false), alpha_(255) { | 501 : fade_everything_(false), alpha_(255) { |
| 502 } | 502 } |
| 503 CardUnmaskPromptViews::FadeOutView::~FadeOutView() { | 503 CardUnmaskPromptViews::FadeOutView::~FadeOutView() { |
| 504 } | 504 } |
| 505 | 505 |
| 506 void CardUnmaskPromptViews::FadeOutView::PaintChildren( | 506 void CardUnmaskPromptViews::FadeOutView::PaintChildren( |
| 507 const ui::PaintContext& context) { | 507 const views::PaintInfo& paint_info) { |
| 508 const bool kLcdTextRequiresOpaqueLayer = true; | 508 const bool kLcdTextRequiresOpaqueLayer = true; |
| 509 ui::CompositingRecorder recorder(context, alpha_, | 509 ui::CompositingRecorder recorder(paint_info.context(), alpha_, |
| 510 kLcdTextRequiresOpaqueLayer); | 510 kLcdTextRequiresOpaqueLayer); |
| 511 views::View::PaintChildren(context); | 511 views::View::PaintChildren(paint_info); |
| 512 } | 512 } |
| 513 | 513 |
| 514 void CardUnmaskPromptViews::FadeOutView::OnPaint(gfx::Canvas* canvas) { | 514 void CardUnmaskPromptViews::FadeOutView::OnPaint(gfx::Canvas* canvas) { |
| 515 if (!fade_everything_ || alpha_ == 255) | 515 if (!fade_everything_ || alpha_ == 255) |
| 516 return views::View::OnPaint(canvas); | 516 return views::View::OnPaint(canvas); |
| 517 | 517 |
| 518 canvas->SaveLayerAlpha(alpha_); | 518 canvas->SaveLayerAlpha(alpha_); |
| 519 views::View::OnPaint(canvas); | 519 views::View::OnPaint(canvas); |
| 520 canvas->Restore(); | 520 canvas->Restore(); |
| 521 } | 521 } |
| 522 | 522 |
| 523 void CardUnmaskPromptViews::FadeOutView::SetAlpha(uint8_t alpha) { | 523 void CardUnmaskPromptViews::FadeOutView::SetAlpha(uint8_t alpha) { |
| 524 alpha_ = alpha; | 524 alpha_ = alpha; |
| 525 SchedulePaint(); | 525 SchedulePaint(); |
| 526 } | 526 } |
| 527 | 527 |
| 528 } // namespace autofill | 528 } // namespace autofill |
| OLD | NEW |