Commit 450e561c authored by Christian Dullweber's avatar Christian Dullweber Committed by Commit Bot

Use separate cookie blocked icon

The blocked badge doesn't fit well with the shield icon, so a separate
icon is added to indicate when cookies were blocked.

https://screenshot.googleplex.com/XeT9kWgEYqw.png

Also fix an issue where the UI is not updated correctly from initial
state.

Bug: 967668
Change-Id: I1bfdfe8eea764c0e364c62c6db20a0c698ccf370
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1768467
Commit-Queue: Christian Dullweber <dullweber@chromium.org>
Reviewed-by: default avatarEvan Stade <estade@chromium.org>
Cr-Commit-Position: refs/heads/master@{#691145}
parent 089f691d
...@@ -85,6 +85,7 @@ aggregate_vector_icons("chrome_vector_icons") { ...@@ -85,6 +85,7 @@ aggregate_vector_icons("chrome_vector_icons") {
"save_original_file.icon", "save_original_file.icon",
"security.icon", "security.icon",
"send_tab_to_self.icon", "send_tab_to_self.icon",
"shield_dot.icon",
"shield_off.icon", "shield_off.icon",
"shield_outline.icon", "shield_outline.icon",
"sensors.icon", "sensors.icon",
......
// Copyright 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
CANVAS_DIMENSIONS, 16,
MOVE_TO, 14, 6.24f,
LINE_TO, 14, 7.36f,
CUBIC_TO, 14, 10.9f, 11.44f, 14.2f, 8, 15,
CUBIC_TO, 4.56f, 14.2f, 2, 10.9f, 2, 7.36f,
LINE_TO, 2, 3.55f,
LINE_TO, 8, 1,
LINE_TO, 9.94f, 1.82f,
CUBIC_TO, 9.62f, 2.12f, 9.37f, 2.49f, 9.21f, 2.91f,
LINE_TO, 8, 2.39f,
LINE_TO, 3.33f, 4.37f,
LINE_TO, 3.33f, 7.36f,
CUBIC_TO, 3.33f, 10.24f, 5.32f, 12.89f, 8, 13.68f,
CUBIC_TO, 10.68f, 12.89f, 12.67f, 10.24f, 12.67f, 7.36f,
LINE_TO, 12.67f, 6.93f,
CUBIC_TO, 13.17f, 6.81f, 13.63f, 6.57f, 14, 6.24f,
CLOSE,
NEW_PATH,
PATH_COLOR_ARGB, 0xFF, 0x1A, 0x73, 0xE8,
MOVE_TO, 12, 6,
CUBIC_TO, 10.9f, 6, 10, 5.1f, 10, 4,
CUBIC_TO, 10, 2.9f, 10.9f, 2, 12, 2,
CUBIC_TO, 13.1f, 2, 14, 2.9f, 14, 4,
CUBIC_TO, 14, 5.1f, 13.1f, 6, 12, 6,
CLOSE
...@@ -67,7 +67,8 @@ void CookieControlsBubbleView::OnBlockedCookiesCountChanged( ...@@ -67,7 +67,8 @@ void CookieControlsBubbleView::OnBlockedCookiesCountChanged(
if (blocked_cookies_ == blocked_cookies) if (blocked_cookies_ == blocked_cookies)
return; return;
bool has_blocked_changed = (blocked_cookies_ > 0) != (blocked_cookies > 0); bool has_blocked_changed =
blocked_cookies_ == -1 || (blocked_cookies_ > 0) != (blocked_cookies > 0);
blocked_cookies_ = blocked_cookies; blocked_cookies_ = blocked_cookies;
sub_title_->SetText( sub_title_->SetText(
...@@ -152,6 +153,7 @@ void CookieControlsBubbleView::Init() { ...@@ -152,6 +153,7 @@ void CookieControlsBubbleView::Init() {
sub_title_ = new views::Label(base::string16(), views::style::CONTEXT_LABEL); sub_title_ = new views::Label(base::string16(), views::style::CONTEXT_LABEL);
sub_title_->SetBorder(views::CreateEmptyBorder(8, 0, 0, 0)); sub_title_->SetBorder(views::CreateEmptyBorder(8, 0, 0, 0));
sub_title_->SetHorizontalAlignment(gfx::HorizontalAlignment::ALIGN_LEFT); sub_title_->SetHorizontalAlignment(gfx::HorizontalAlignment::ALIGN_LEFT);
sub_title_->SetMultiLine(true);
AddChildView(sub_title_); AddChildView(sub_title_);
spacer_ = new views::View(); spacer_ = new views::View();
......
...@@ -95,14 +95,7 @@ views::BubbleDialogDelegateView* CookieControlsIconView::GetBubble() const { ...@@ -95,14 +95,7 @@ views::BubbleDialogDelegateView* CookieControlsIconView::GetBubble() const {
const gfx::VectorIcon& CookieControlsIconView::GetVectorIcon() const { const gfx::VectorIcon& CookieControlsIconView::GetVectorIcon() const {
if (status_ == CookieControlsController::Status::kDisabledForSite) if (status_ == CookieControlsController::Status::kDisabledForSite)
return kShieldOffIcon; return kShieldOffIcon;
return kShieldOutlineIcon; return has_blocked_cookies_ ? kShieldDotIcon : kShieldOutlineIcon;
}
const gfx::VectorIcon& CookieControlsIconView::GetVectorIconBadge() const {
if (status_ == CookieControlsController::Status::kEnabled &&
has_blocked_cookies_)
return kBlockedBadgeIcon;
return gfx::kNoneIcon;
} }
base::string16 CookieControlsIconView::GetTextForTooltipAndAccessibleName() base::string16 CookieControlsIconView::GetTextForTooltipAndAccessibleName()
......
...@@ -32,7 +32,6 @@ class CookieControlsIconView : public PageActionIconView, ...@@ -32,7 +32,6 @@ class CookieControlsIconView : public PageActionIconView,
protected: protected:
void OnExecuting(PageActionIconView::ExecuteSource source) override; void OnExecuting(PageActionIconView::ExecuteSource source) override;
const gfx::VectorIcon& GetVectorIcon() const override; const gfx::VectorIcon& GetVectorIcon() const override;
const gfx::VectorIcon& GetVectorIconBadge() const override;
private: private:
bool HasAssociatedBubble() const; bool HasAssociatedBubble() const;
......
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