Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1552)

Unified Diff: chrome/browser/ui/views/location_bar/location_icon_view.cc

Issue 2144903004: New location security strings and animation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Don't animate if level is same Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/views/location_bar/location_icon_view.cc
diff --git a/chrome/browser/ui/views/location_bar/location_icon_view.cc b/chrome/browser/ui/views/location_bar/location_icon_view.cc
index 03382cc2a54d3a2991f4245b0b071d5787b8ac90..598256fb99d6c08ea5b46a8f4a4de3922d5ae529 100644
--- a/chrome/browser/ui/views/location_bar/location_icon_view.cc
+++ b/chrome/browser/ui/views/location_bar/location_icon_view.cc
@@ -22,7 +22,6 @@
#include "ui/views/controls/label.h"
#include "ui/views/painter.h"
-using content::NavigationController;
using content::NavigationEntry;
using content::WebContents;
@@ -34,7 +33,8 @@ LocationIconView::LocationIconView(const gfx::FontList& font_list,
parent_background_color,
true),
suppress_mouse_released_action_(false),
- location_bar_(location_bar) {
+ location_bar_(location_bar),
+ animation_(this) {
set_id(VIEW_ID_LOCATION_ICON);
#if defined(OS_MACOSX)
@@ -44,6 +44,7 @@ LocationIconView::LocationIconView(const gfx::FontList& font_list,
#endif
SetBackground(false);
+ animation_.SetSlideDuration(kOpenTimeMS);
}
LocationIconView::~LocationIconView() {
@@ -124,7 +125,8 @@ gfx::Size LocationIconView::GetMinimumSizeForLabelText(
}
SkColor LocationIconView::GetTextColor() const {
- return location_bar_->GetColor(LocationBarView::EV_BUBBLE_TEXT_AND_BORDER);
+ return location_bar_->GetColor(
+ LocationBarView::SECURITY_CHIP_TEXT_AND_BORDER);
}
SkColor LocationIconView::GetBorderColor() const {
@@ -166,3 +168,28 @@ void LocationIconView::SetBackground(bool should_show_ev) {
else
UnsetBackgroundImageGrid();
}
+
+void LocationIconView::AnimateSecurityChip() {
Peter Kasting 2016/08/20 01:16:43 Nit: .cc definition order must match .h declaratio
Kevin Bailey 2016/08/22 15:58:56 I'm confused. It appears to match to me.
Peter Kasting 2016/08/22 22:58:09 The issue is primarily with the existing methods i
Kevin Bailey 2016/08/23 15:17:13 The issue is entirely with the existing methods. I
+ animation_.Show();
+}
+
+void LocationIconView::ShowSecurityChip() {
+ animation_.Reset(1);
+}
+
+void LocationIconView::HideSecurityChip() {
+ animation_.Reset(0);
+}
+
+bool LocationIconView::IsAnimatingSecurityChip() {
+ return animation_.is_animating() && animation_.GetCurrentValue() < 1;
Peter Kasting 2016/08/20 01:16:43 Why is the second clause necessary?
Kevin Bailey 2016/08/22 15:58:56 It isn't; I thought 'is_animating' was staying tru
+}
+
+void LocationIconView::AnimationProgressed(const gfx::Animation*) {
+ location_bar_->Layout();
+ location_bar_->SchedulePaint();
+}
+
+double LocationIconView::WidthMultiplier() const {
+ return animation_.GetCurrentValue();
+}

Powered by Google App Engine
This is Rietveld 408576698