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

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

Issue 1935663002: New origin security indicator icons. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Shorten the Views GetSecureTextColor further, thanks to pkasting. Created 4 years, 7 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_bar_view.cc
diff --git a/chrome/browser/ui/views/location_bar/location_bar_view.cc b/chrome/browser/ui/views/location_bar/location_bar_view.cc
index 6b4235d1f1b8bcacf45da01c17582ccdf9de49a4..1a4726c5df492550a99e5baa9271ecffa869b051 100644
--- a/chrome/browser/ui/views/location_bar/location_bar_view.cc
+++ b/chrome/browser/ui/views/location_bar/location_bar_view.cc
@@ -339,37 +339,24 @@ SkColor LocationBarView::GetColor(
SkColor LocationBarView::GetSecureTextColor(
security_state::SecurityStateModel::SecurityLevel security_level) const {
- bool inverted = color_utils::IsDark(GetColor(BACKGROUND));
- SkColor color;
- switch (security_level) {
- case security_state::SecurityStateModel::EV_SECURE:
- case security_state::SecurityStateModel::SECURE:
- if (ui::MaterialDesignController::IsModeMaterial() && inverted)
- return GetColor(TEXT);
- color = GetColor(EV_BUBBLE_TEXT_AND_BORDER);
- break;
-
- case security_state::SecurityStateModel::SECURITY_POLICY_WARNING:
- return GetColor(DEEMPHASIZED_TEXT);
- break;
-
- case security_state::SecurityStateModel::SECURITY_ERROR: {
- bool md = ui::MaterialDesignController::IsModeMaterial();
- if (md && inverted)
- return GetColor(TEXT);
- color = md ? gfx::kGoogleRed700 : SkColorSetRGB(162, 0, 0);
- break;
- }
-
- case security_state::SecurityStateModel::SECURITY_WARNING:
- return GetColor(TEXT);
- break;
+ if (security_level ==
+ security_state::SecurityStateModel::SECURITY_POLICY_WARNING) {
Peter Kasting 2016/05/20 00:14:12 Nit: No {} (use it when the body is multiple lines
+ return GetColor(DEEMPHASIZED_TEXT);
+ }
- default:
- NOTREACHED();
- return gfx::kPlaceholderColor;
+ SkColor text_color = GetColor(TEXT);
+ if ((security_level == security_state::SecurityStateModel::EV_SECURE) ||
+ (security_level == security_state::SecurityStateModel::SECURE) ||
+ (security_level == security_state::SecurityStateModel::SECURITY_ERROR)) {
+ const bool md = ui::MaterialDesignController::IsModeMaterial();
+ if (md && color_utils::IsDark(GetColor(BACKGROUND)))
+ return text_color;
+ if (security_level == security_state::SecurityStateModel::SECURITY_ERROR)
+ text_color = md ? gfx::kGoogleRed700 : SkColorSetRGB(162, 0, 0);
+ else
+ text_color = GetColor(EV_BUBBLE_TEXT_AND_BORDER);
}
- return color_utils::GetReadableColor(color, GetColor(BACKGROUND));
+ return color_utils::GetReadableColor(text_color, GetColor(BACKGROUND));
}
void LocationBarView::ZoomChangedForActiveTab(bool can_show_bubble) {
@@ -869,9 +856,12 @@ void LocationBarView::RefreshLocationIcon() {
icon_id = gfx::VectorIconId::LOCATION_BAR_HTTPS_VALID_IN_CHIP;
icon_color = location_icon_view_->GetTextColor();
} else {
- icon_id = omnibox_view_->GetVectorIcon(
- color_utils::IsDark(GetColor(BACKGROUND)));
- icon_color = color_utils::DeriveDefaultIconColor(GetColor(TEXT));
+ icon_id = omnibox_view_->GetVectorIcon();
+ security_state::SecurityStateModel::SecurityLevel security_level =
+ GetToolbarModel()->GetSecurityLevel(false);
+ icon_color = (security_level == security_state::SecurityStateModel::NONE)
+ ? color_utils::DeriveDefaultIconColor(GetColor(TEXT))
+ : GetSecureTextColor(security_level);
}
location_icon_view_->SetImage(
gfx::CreateVectorIcon(icon_id, kIconSize, icon_color));

Powered by Google App Engine
This is Rietveld 408576698