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

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

Issue 1448433004: [MD] update EV bubble icon and location bar https icons (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: update Created 5 years, 1 month 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 eb0f26496df35594792cf95bb26162c0b0fdaab7..f683c93f6dd9f22ff2e310538b3fd2018ea416e5 100644
--- a/chrome/browser/ui/views/location_bar/location_bar_view.cc
+++ b/chrome/browser/ui/views/location_bar/location_bar_view.cc
@@ -339,8 +339,7 @@ SkColor LocationBarView::GetColor(
SkColor LocationBarView::GetSecureTextColor(
SecurityStateModel::SecurityLevel security_level) const {
- bool inverted =
- color_utils::GetLuminanceForColor(GetColor(BACKGROUND)) < 128;
+ bool inverted = color_utils::IsDark(GetColor(BACKGROUND));
SkColor color;
switch (security_level) {
case SecurityStateModel::EV_SECURE:
@@ -792,6 +791,7 @@ void LocationBarView::OnNativeThemeChanged(const ui::NativeTheme* theme) {
if (!ui::MaterialDesignController::IsModeMaterial())
return;
+ RefreshLocationIcon();
set_background(new BackgroundWith1PxBorder(
GetColor(BACKGROUND), SkColorSetARGB(0x4D, 0x00, 0x00, 0x00),
is_popup_mode_));
@@ -868,6 +868,21 @@ int LocationBarView::VerticalPadding() const {
kPopupEdgeThickness : GetLayoutConstant(LOCATION_BAR_VERTICAL_PADDING);
}
+void LocationBarView::RefreshLocationIcon() {
+ // |omnibox_view_| may not be ready yet.
Peter Kasting 2015/11/17 21:27:03 If you really need this conditional, this comment
Evan Stade 2015/11/17 22:57:21 Done.
+ if (!omnibox_view_)
+ return;
+
+ if (ui::MaterialDesignController::IsModeMaterial()) {
+ location_icon_view_->SetImage(gfx::CreateVectorIcon(
+ omnibox_view_->GetVectorIcon(color_utils::IsDark(GetColor(BACKGROUND))),
+ 16, color_utils::DeriveDefaultIconColor(GetColor(TEXT))));
+ } else {
+ location_icon_view_->SetImage(
+ *GetThemeProvider()->GetImageSkiaNamed(omnibox_view_->GetIcon()));
+ }
+}
+
bool LocationBarView::RefreshContentSettingViews() {
bool visibility_changed = false;
for (ContentSettingViews::const_iterator i(content_setting_views_.begin());
@@ -1357,11 +1372,7 @@ void LocationBarView::AnimationEnded(const gfx::Animation* animation) {
// LocationBarView, private OmniboxEditController implementation:
void LocationBarView::OnChanged() {
- location_icon_view_->SetImage(
- ui::MaterialDesignController::IsModeMaterial()
- ? gfx::CreateVectorIcon(omnibox_view_->GetVectorIcon(), 16,
- gfx::kChromeIconGrey)
- : *GetThemeProvider()->GetImageSkiaNamed(omnibox_view_->GetIcon()));
+ RefreshLocationIcon();
location_icon_view_->ShowTooltip(!GetOmniboxView()->IsEditingOrEmpty());
Layout();

Powered by Google App Engine
This is Rietveld 408576698