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

Side by Side 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: Take estade's advice on the dimness problem (solved, thanks!). 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/ui/views/location_bar/location_bar_view.h" 5 #include "chrome/browser/ui/views/location_bar/location_bar_view.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <map> 8 #include <map>
9 9
10 #include "base/i18n/rtl.h" 10 #include "base/i18n/rtl.h"
(...skipping 344 matching lines...) Expand 10 before | Expand all | Expand 10 after
355 355
356 case security_state::SecurityStateModel::SECURITY_ERROR: { 356 case security_state::SecurityStateModel::SECURITY_ERROR: {
357 bool md = ui::MaterialDesignController::IsModeMaterial(); 357 bool md = ui::MaterialDesignController::IsModeMaterial();
358 if (md && inverted) 358 if (md && inverted)
359 return GetColor(TEXT); 359 return GetColor(TEXT);
360 color = md ? gfx::kGoogleRed700 : SkColorSetRGB(162, 0, 0); 360 color = md ? gfx::kGoogleRed700 : SkColorSetRGB(162, 0, 0);
361 break; 361 break;
362 } 362 }
363 363
364 case security_state::SecurityStateModel::SECURITY_WARNING: 364 case security_state::SecurityStateModel::SECURITY_WARNING:
365 case security_state::SecurityStateModel::NONE:
Evan Stade 2016/05/12 16:08:11 I'd rather you not add this, doesn't seem necessar
palmer 2016/05/12 21:23:14 Done.
365 return GetColor(TEXT); 366 return GetColor(TEXT);
366 break; 367 break;
367 368
368 default: 369 default:
369 NOTREACHED(); 370 NOTREACHED();
370 return gfx::kPlaceholderColor; 371 return gfx::kPlaceholderColor;
371 } 372 }
372 return color_utils::GetReadableColor(color, GetColor(BACKGROUND)); 373 return color_utils::GetReadableColor(color, GetColor(BACKGROUND));
373 } 374 }
374 375
(...skipping 487 matching lines...) Expand 10 before | Expand all | Expand 10 after
862 return; 863 return;
863 864
864 if (ui::MaterialDesignController::IsModeMaterial()) { 865 if (ui::MaterialDesignController::IsModeMaterial()) {
865 gfx::VectorIconId icon_id = gfx::VectorIconId::VECTOR_ICON_NONE; 866 gfx::VectorIconId icon_id = gfx::VectorIconId::VECTOR_ICON_NONE;
866 const int kIconSize = 16; 867 const int kIconSize = 16;
867 SkColor icon_color = gfx::kPlaceholderColor; 868 SkColor icon_color = gfx::kPlaceholderColor;
868 if (ShouldShowEVBubble()) { 869 if (ShouldShowEVBubble()) {
869 icon_id = gfx::VectorIconId::LOCATION_BAR_HTTPS_VALID_IN_CHIP; 870 icon_id = gfx::VectorIconId::LOCATION_BAR_HTTPS_VALID_IN_CHIP;
870 icon_color = location_icon_view_->GetTextColor(); 871 icon_color = location_icon_view_->GetTextColor();
871 } else { 872 } else {
872 icon_id = omnibox_view_->GetVectorIcon( 873 icon_id = omnibox_view_->GetVectorIcon();
873 color_utils::IsDark(GetColor(BACKGROUND))); 874 security_state::SecurityStateModel::SecurityLevel security_level =
874 icon_color = color_utils::DeriveDefaultIconColor(GetColor(TEXT)); 875 GetToolbarModel()->GetSecurityLevel(false);
876 icon_color = GetSecureTextColor(security_level);
Evan Stade 2016/05/12 16:08:11 icon_color = security_level == security_state::Sec
palmer 2016/05/12 21:23:14 Done.
877 // The |GetSecureTextColor| is correct for states with 'marked' security
878 // indicator colors, but to get the final color for the NONE state we need
879 // to do a bit more work:
880 if (security_level == security_state::SecurityStateModel::NONE)
881 icon_color = color_utils::DeriveDefaultIconColor(icon_color);
875 } 882 }
876 location_icon_view_->SetImage( 883 location_icon_view_->SetImage(
877 gfx::CreateVectorIcon(icon_id, kIconSize, icon_color)); 884 gfx::CreateVectorIcon(icon_id, kIconSize, icon_color));
878 } else { 885 } else {
879 location_icon_view_->SetImage( 886 location_icon_view_->SetImage(
880 *GetThemeProvider()->GetImageSkiaNamed(omnibox_view_->GetIcon())); 887 *GetThemeProvider()->GetImageSkiaNamed(omnibox_view_->GetIcon()));
881 } 888 }
882 } 889 }
883 890
884 bool LocationBarView::RefreshContentSettingViews() { 891 bool LocationBarView::RefreshContentSettingViews() {
(...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after
1384 // LocationBarView, private TemplateURLServiceObserver implementation: 1391 // LocationBarView, private TemplateURLServiceObserver implementation:
1385 1392
1386 void LocationBarView::OnTemplateURLServiceChanged() { 1393 void LocationBarView::OnTemplateURLServiceChanged() {
1387 template_url_service_->RemoveObserver(this); 1394 template_url_service_->RemoveObserver(this);
1388 template_url_service_ = nullptr; 1395 template_url_service_ = nullptr;
1389 // If the browser is no longer active, let's not show the info bubble, as this 1396 // If the browser is no longer active, let's not show the info bubble, as this
1390 // would make the browser the active window again. 1397 // would make the browser the active window again.
1391 if (omnibox_view_ && omnibox_view_->GetWidget()->IsActive()) 1398 if (omnibox_view_ && omnibox_view_->GetWidget()->IsActive())
1392 ShowFirstRunBubble(); 1399 ShowFirstRunBubble();
1393 } 1400 }
OLDNEW
« no previous file with comments | « no previous file | components/omnibox/browser/omnibox_view.h » ('j') | ui/gfx/vector_icons/location_bar_https_valid.icon » ('J')

Powered by Google App Engine
This is Rietveld 408576698