Commit 2ef3d9ac authored by Allen Bauer's avatar Allen Bauer Committed by Commit Bot

Force the star icon to highlight when using the keyboard shortcut for adding a bookmark.

Bug: 773979
Change-Id: I1a2bc9a86e898c3a91fcdfdc97296972dbdff723
Reviewed-on: https://chromium-review.googlesource.com/825627Reviewed-by: default avatarPeter Kasting <pkasting@chromium.org>
Commit-Queue: Allen Bauer <kylixrd@chromium.org>
Cr-Commit-Position: refs/heads/master@{#524376}
parent 0b5a1d44
......@@ -30,6 +30,12 @@ StarView::StarView(CommandUpdater* command_updater, Browser* browser)
StarView::~StarView() {}
void StarView::SetHighlighted() {
views::InkDrop* ink_drop = GetInkDrop();
if (ink_drop && !ink_drop->IsHighlightFadingInOrVisible())
AnimateInkDrop(views::InkDropState::ACTIVATED, nullptr);
}
void StarView::SetToggled(bool on) {
BubbleIconView::SetActiveInternal(on);
SetTooltipText(l10n_util::GetStringUTF16(
......
......@@ -19,6 +19,9 @@ class StarView : public BubbleIconView {
StarView(CommandUpdater* command_updater, Browser* browser);
~StarView() override;
// Show the Animated Ink drop highlight.
void SetHighlighted();
// Toggles the star on or off.
void SetToggled(bool on);
......
......@@ -21,6 +21,7 @@
#include "content/public/test/test_utils.h"
#include "ui/base/ui_base_switches.h"
#include "ui/events/event_utils.h"
#include "ui/views/animation/test/ink_drop_host_view_test_api.h"
#if defined(OS_WIN)
#include "ui/aura/window.h"
......@@ -68,4 +69,17 @@ IN_PROC_BROWSER_TEST_F(StarViewTest, MAYBE_HideOnSecondClick) {
EXPECT_FALSE(BookmarkBubbleView::bookmark_bubble());
}
IN_PROC_BROWSER_TEST_F(StarViewTest, InkDropHighlighted) {
BrowserView* browser_view =
reinterpret_cast<BrowserView*>(browser()->window());
StarView* star_view = browser_view->toolbar()->location_bar()->star_view();
views::test::InkDropHostViewTestApi ink_drop_test_api(star_view);
if (ink_drop_test_api.HasInkDrop()) {
browser_view->ShowBookmarkBubble(GURL("http://test.com"), false);
EXPECT_EQ(ink_drop_test_api.GetInkDrop()->GetTargetInkDropState(),
views::InkDropState::ACTIVATED);
}
}
} // namespace
......@@ -296,8 +296,10 @@ void ToolbarView::ShowBookmarkBubble(
views::Widget* bubble_widget = BookmarkBubbleView::ShowBubble(
anchor_view, gfx::Rect(), nullptr, observer, std::move(delegate),
browser_->profile(), url, already_bookmarked);
if (bubble_widget && star_view)
if (bubble_widget && star_view) {
star_view->SetHighlighted();
bubble_widget->AddObserver(star_view);
}
}
void ToolbarView::ShowTranslateBubble(
......
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