Commit 8ccb7a83 authored by Christian Dullweber's avatar Christian Dullweber Committed by Commit Bot

Remove 'no cookies blocked' UI state from cookie controls bubble

To simplify the UI, we remove the omnibox icon when third-party
cookie blocking is on but no cookies have been blocked.
This is similar to how the old cookies blocked icon worked.

Bug: 1019131
Change-Id: Id755ddcd10976d22cbcc67de18725382ab9eee78
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1886862
Commit-Queue: Christian Dullweber <dullweber@chromium.org>
Reviewed-by: default avatarEvan Stade <estade@chromium.org>
Reviewed-by: default avatarMitsuru Oshima <oshima@chromium.org>
Cr-Commit-Position: refs/heads/master@{#710441}
parent 04a0ec29
...@@ -2566,9 +2566,6 @@ are declared in tools/grit/grit_rule.gni. ...@@ -2566,9 +2566,6 @@ are declared in tools/grit/grit_rule.gni.
<message name="IDS_COOKIE_CONTROLS_NOT_WORKING_DESCRIPTION" desc="Label shown on a dialog that allows users to turn off third-party cookie blocking for a specific site."> <message name="IDS_COOKIE_CONTROLS_NOT_WORKING_DESCRIPTION" desc="Label shown on a dialog that allows users to turn off third-party cookie blocking for a specific site.">
Some sites use third-party cookies to load their pages. If a site isn't working, you can try turning off cookie blocking. Some sites use third-party cookies to load their pages. If a site isn't working, you can try turning off cookie blocking.
</message> </message>
<message name="IDS_COOKIE_CONTROLS_NOTHING_BLOCKED_MESSAGE" desc="Text shown in the dialog that allows users to control cookie blocking.">
This site is free of cookies that can be used to track you across the web
</message>
<message name="IDS_COOKIE_CONTROLS_BLOCKED_MESSAGE" desc="Text shown in the dialog that allows users to control cookie blocking."> <message name="IDS_COOKIE_CONTROLS_BLOCKED_MESSAGE" desc="Text shown in the dialog that allows users to control cookie blocking.">
Chrome is blocking cookies that can be used to track you across the web Chrome is blocking cookies that can be used to track you across the web
</message> </message>
......
...@@ -289,7 +289,6 @@ ...@@ -289,7 +289,6 @@
</if> </if>
<if expr="not is_android"> <if expr="not is_android">
<structure type="chrome_scaled_image" name="IDR_COOKIE_BLOCKING_ON_HEADER" file="common/cookie_blocking_on_header.png" /> <structure type="chrome_scaled_image" name="IDR_COOKIE_BLOCKING_ON_HEADER" file="common/cookie_blocking_on_header.png" />
<structure type="chrome_scaled_image" name="IDR_COOKIE_BLOCKING_INACTIVE_HEADER" file="common/cookie_blocking_inactive_header.png" />
<structure type="chrome_scaled_image" name="IDR_COOKIE_BLOCKING_OFF_HEADER" file="common/cookie_blocking_off_header.png" /> <structure type="chrome_scaled_image" name="IDR_COOKIE_BLOCKING_OFF_HEADER" file="common/cookie_blocking_off_header.png" />
</if> </if>
<structure type="chrome_scaled_image" name="IDR_TAB_DROP_DOWN" file="tab_drop_down.png" /> <structure type="chrome_scaled_image" name="IDR_TAB_DROP_DOWN" file="tab_drop_down.png" />
......
...@@ -96,7 +96,6 @@ aggregate_vector_icons("chrome_vector_icons") { ...@@ -96,7 +96,6 @@ aggregate_vector_icons("chrome_vector_icons") {
"security.icon", "security.icon",
"send_tab_to_self.icon", "send_tab_to_self.icon",
"eye_crossed.icon", "eye_crossed.icon",
"eye_crossed_dot.icon",
"eye.icon", "eye.icon",
"sensors.icon", "sensors.icon",
"signin_button_drop_down_arrow.icon", "signin_button_drop_down_arrow.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, 13.93f, 5.37f,
CUBIC_TO, 13.55f, 5.55f, 13.12f, 5.65f, 12.67f, 5.65f,
CUBIC_TO, 11.08f, 5.65f, 9.78f, 4.41f, 9.67f, 2.85f,
CUBIC_TO, 9.13f, 2.73f, 8.57f, 2.67f, 8, 2.67f,
CUBIC_TO, 7.3f, 2.67f, 6.63f, 2.76f, 5.99f, 2.93f,
LINE_TO, 7.44f, 4.38f,
CUBIC_TO, 7.62f, 4.35f, 7.81f, 4.34f, 8, 4.34f,
CUBIC_TO, 8.88f, 4.34f, 9.73f, 4.69f, 10.36f, 5.31f,
CUBIC_TO, 10.98f, 5.94f, 11.33f, 6.79f, 11.33f, 7.67f,
CUBIC_TO, 11.33f, 7.86f, 11.32f, 8.05f, 11.29f, 8.23f,
LINE_TO, 13.49f, 10.44f,
CUBIC_TO, 14.29f, 9.66f, 14.92f, 8.72f, 15.33f, 7.67f,
CUBIC_TO, 15, 6.82f, 14.52f, 6.05f, 13.93f, 5.37f,
CLOSE,
MOVE_TO, 2.53f, 1.47f,
LINE_TO, 1.47f, 2.53f,
LINE_TO, 3.22f, 4.29f,
CUBIC_TO, 2.09f, 5.15f, 1.2f, 6.32f, 0.67f, 7.67f,
CUBIC_TO, 1.82f, 10.6f, 4.67f, 12.67f, 8, 12.67f,
CUBIC_TO, 9.07f, 12.67f, 10.08f, 12.46f, 11.01f, 12.07f,
LINE_TO, 13.47f, 14.53f,
LINE_TO, 14.53f, 13.47f,
LINE_TO, 2.53f, 1.47f,
CLOSE,
MOVE_TO, 4.67f, 7.67f,
CUBIC_TO, 4.67f, 7.12f, 4.8f, 6.59f, 5.05f, 6.12f,
LINE_TO, 6.07f, 7.14f,
CUBIC_TO, 6.02f, 7.31f, 6, 7.49f, 6, 7.67f,
CUBIC_TO, 6, 8.2f, 6.21f, 8.71f, 6.59f, 9.08f,
CUBIC_TO, 6.96f, 9.46f, 7.47f, 9.67f, 8, 9.67f,
CUBIC_TO, 8.18f, 9.67f, 8.36f, 9.65f, 8.53f, 9.6f,
LINE_TO, 9.55f, 10.62f,
CUBIC_TO, 9.08f, 10.87f, 8.55f, 11, 8, 11,
CUBIC_TO, 7.12f, 11, 6.27f, 10.65f, 5.64f, 10.03f,
CUBIC_TO, 5.02f, 9.4f, 4.67f, 8.55f, 4.67f, 7.67f,
CLOSE,
NEW_PATH,
PATH_COLOR_ARGB, 0xFF, 0x1A, 0x73, 0xE8,
MOVE_TO, 12.67f, 4.65f,
CUBIC_TO, 13.77f, 4.65f, 14.67f, 3.75f, 14.67f, 2.65f,
CUBIC_TO, 14.67f, 1.55f, 13.77f, 0.65f, 12.67f, 0.65f,
CUBIC_TO, 11.56f, 0.65f, 10.67f, 1.55f, 10.67f, 2.65f,
CUBIC_TO, 10.67f, 3.75f, 11.56f, 4.65f, 12.67f, 4.65f,
CLOSE
...@@ -89,16 +89,8 @@ void CookieControlsBubbleView::OnBlockedCookiesCountChanged( ...@@ -89,16 +89,8 @@ void CookieControlsBubbleView::OnBlockedCookiesCountChanged(
if (blocked_cookies_ == blocked_cookies) if (blocked_cookies_ == blocked_cookies)
return; return;
bool has_blocked_changed =
!blocked_cookies_ || (*blocked_cookies_ > 0) != (blocked_cookies > 0);
blocked_cookies_ = blocked_cookies; blocked_cookies_ = blocked_cookies;
GetBubbleFrameView()->UpdateWindowTitle();
// If this only incremented the number of blocked sites, no full UI update is
// necessary besides the title text.
if (has_blocked_changed)
UpdateUi();
else
GetBubbleFrameView()->UpdateWindowTitle();
} }
CookieControlsBubbleView::CookieControlsBubbleView( CookieControlsBubbleView::CookieControlsBubbleView(
...@@ -122,7 +114,6 @@ void CookieControlsBubbleView::UpdateUi() { ...@@ -122,7 +114,6 @@ void CookieControlsBubbleView::UpdateUi() {
DialogModelChanged(); DialogModelChanged();
GetBubbleFrameView()->UpdateWindowTitle(); GetBubbleFrameView()->UpdateWindowTitle();
bool has_blocked_cookies = blocked_cookies_ > 0;
not_working_link_->SetVisible(false); not_working_link_->SetVisible(false);
text_->SetVisible(false); text_->SetVisible(false);
...@@ -136,13 +127,11 @@ void CookieControlsBubbleView::UpdateUi() { ...@@ -136,13 +127,11 @@ void CookieControlsBubbleView::UpdateUi() {
header_view_->SetVisible(true); header_view_->SetVisible(true);
header_view_->SetImage( header_view_->SetImage(
ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed( ui::ResourceBundle::GetSharedInstance().GetImageSkiaNamed(
has_blocked_cookies ? IDR_COOKIE_BLOCKING_ON_HEADER IDR_COOKIE_BLOCKING_ON_HEADER));
: IDR_COOKIE_BLOCKING_INACTIVE_HEADER));
text_->SetVisible(true); text_->SetVisible(true);
text_->SetText(l10n_util::GetStringUTF16( text_->SetText(
has_blocked_cookies ? IDS_COOKIE_CONTROLS_BLOCKED_MESSAGE l10n_util::GetStringUTF16(IDS_COOKIE_CONTROLS_BLOCKED_MESSAGE));
: IDS_COOKIE_CONTROLS_NOTHING_BLOCKED_MESSAGE)); not_working_link_->SetVisible(true);
not_working_link_->SetVisible(has_blocked_cookies);
blocked_cookies_.reset(); blocked_cookies_.reset();
} else { } else {
DCHECK_EQ(status_, CookieControlsController::Status::kDisabledForSite); DCHECK_EQ(status_, CookieControlsController::Status::kDisabledForSite);
......
...@@ -55,7 +55,7 @@ void CookieControlsIconView::OnBlockedCookiesCountChanged(int blocked_cookies) { ...@@ -55,7 +55,7 @@ void CookieControlsIconView::OnBlockedCookiesCountChanged(int blocked_cookies) {
// UI updates. // UI updates.
if (has_blocked_cookies_ != blocked_cookies > 0) { if (has_blocked_cookies_ != blocked_cookies > 0) {
has_blocked_cookies_ = blocked_cookies > 0; has_blocked_cookies_ = blocked_cookies > 0;
UpdateIconImage(); SetVisible(ShouldBeVisible());
} }
} }
...@@ -69,7 +69,15 @@ bool CookieControlsIconView::ShouldBeVisible() const { ...@@ -69,7 +69,15 @@ bool CookieControlsIconView::ShouldBeVisible() const {
if (!delegate()->GetWebContentsForPageActionIconView()) if (!delegate()->GetWebContentsForPageActionIconView())
return false; return false;
return status_ != CookieControlsController::Status::kDisabled; switch (status_) {
case CookieControlsController::Status::kDisabledForSite:
return true;
case CookieControlsController::Status::kEnabled:
return has_blocked_cookies_;
case CookieControlsController::Status::kDisabled:
case CookieControlsController::Status::kUninitialized:
return false;
}
} }
bool CookieControlsIconView::HasAssociatedBubble() const { bool CookieControlsIconView::HasAssociatedBubble() const {
...@@ -97,7 +105,7 @@ views::BubbleDialogDelegateView* CookieControlsIconView::GetBubble() const { ...@@ -97,7 +105,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 kEyeIcon; return kEyeIcon;
return has_blocked_cookies_ ? kEyeCrossedDotIcon : kEyeCrossedIcon; return kEyeCrossedIcon;
} }
base::string16 CookieControlsIconView::GetTextForTooltipAndAccessibleName() base::string16 CookieControlsIconView::GetTextForTooltipAndAccessibleName()
......
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