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

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: SetSecurityState 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 ac6951e4ccb59e143e87790f7a1c97d138a55f05..3a2458d77a67ea81fa22c50c3789202e5cfc6f37 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() {
@@ -104,7 +105,7 @@ bool LocationIconView::GetTooltipText(const gfx::Point& p,
}
SkColor LocationIconView::GetTextColor() const {
- return location_bar_->GetColor(LocationBarView::EV_BUBBLE_TEXT_AND_BORDER);
+ return location_bar_->GetColor(LocationBarView::SECURITY_CHIP_TEXT);
}
SkColor LocationIconView::GetBorderColor() const {
@@ -146,6 +147,26 @@ void LocationIconView::SetBackground(bool should_show_ev) {
UnsetBackgroundImageGrid();
}
+void LocationIconView::SetSecurityState(bool should_show, bool should_animate) {
+ if (!should_animate) {
+ animation_.Reset(should_show);
+ } else {
Peter Kasting 2016/08/30 01:12:42 Nit: Combine else and subsequent if
Kevin Bailey 2016/08/30 14:07:15 Done.
+ if (should_show)
+ animation_.Show();
+ else
+ animation_.Hide();
+ }
+}
+
+double LocationIconView::WidthMultiplier() const {
+ return animation_.GetCurrentValue();
+}
+
+void LocationIconView::AnimationProgressed(const gfx::Animation*) {
+ location_bar_->Layout();
+ location_bar_->SchedulePaint();
+}
+
void LocationIconView::ProcessLocatedEvent(const ui::LocatedEvent& event) {
if (HitTestPoint(event.location()))
OnActivate(event);

Powered by Google App Engine
This is Rietveld 408576698