Commit 5fb56737 authored by Takumi Fujimoto's avatar Takumi Fujimoto Committed by Commit Bot

[Harmony Cast Dialog] Fix the flickering seen when updating sinks

This fixes the bug in which the selected sink's inkdrop color fades in
instead of snapping to cause a flickering effect.

Bug: 842792
Change-Id: Ic4819552ee6a45f20c654a5ee4d9211b34f1f313
Reviewed-on: https://chromium-review.googlesource.com/1079695Reviewed-by: default avatarBret Sepulveda <bsep@chromium.org>
Commit-Queue: Takumi Fujimoto <takumif@chromium.org>
Cr-Commit-Position: refs/heads/master@{#563081}
parent 902a007c
......@@ -10,6 +10,7 @@
#include "ui/base/ui_base_types.h"
#include "ui/gfx/color_palette.h"
#include "ui/gfx/paint_vector_icon.h"
#include "ui/views/animation/ink_drop_impl.h"
#include "ui/views/controls/throbber.h"
#include "ui/views/vector_icons.h"
......@@ -114,6 +115,15 @@ void CastDialogSinkButton::OnBlur() {
SnapInkDropToActivated();
}
std::unique_ptr<views::InkDrop> CastDialogSinkButton::CreateInkDrop() {
auto ink_drop = HoverButton::CreateInkDrop();
// Without overriding this value, the ink drop would fade in (as opposed to
// snapping), which results in flickers when updating sinks.
static_cast<views::InkDropImpl*>(ink_drop.get())
->SetAutoHighlightMode(views::InkDropImpl::AutoHighlightMode::NONE);
return ink_drop;
}
base::string16 CastDialogSinkButton::GetActionText() const {
return l10n_util::GetStringUTF16(sink_.state == UIMediaSinkState::CONNECTED
? IDS_MEDIA_ROUTER_STOP_CASTING_BUTTON
......
......@@ -12,6 +12,10 @@ namespace ui {
class MouseEvent;
}
namespace views {
class InkDrop;
}
namespace media_router {
// A button representing a sink in the Cast dialog. It is highlighted when
......@@ -28,6 +32,7 @@ class CastDialogSinkButton : public HoverButton {
// views::View:
bool OnMousePressed(const ui::MouseEvent& event) override;
void OnBlur() override;
std::unique_ptr<views::InkDrop> CreateInkDrop() override;
// Returns the text that should be shown on the main action button of the Cast
// dialog when this button is selected.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment