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

Side by Side Diff: chrome/browser/ui/views/location_bar/location_bar_view.cc

Issue 2422303002: Show HTTP-Bad security chip UI on Mac and Views (Closed)
Patch Set: Fix typo Created 4 years, 2 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/command_line.h" 10 #include "base/command_line.h"
(...skipping 807 matching lines...) Expand 10 before | Expand all | Expand 10 after
818 818
819 void LocationBarView::RefreshLocationIcon() { 819 void LocationBarView::RefreshLocationIcon() {
820 // |omnibox_view_| may not be ready yet if Init() has not been called. The 820 // |omnibox_view_| may not be ready yet if Init() has not been called. The
821 // icon will be set soon by OnChanged(). 821 // icon will be set soon by OnChanged().
822 if (!omnibox_view_) 822 if (!omnibox_view_)
823 return; 823 return;
824 824
825 security_state::SecurityStateModel::SecurityLevel security_level = 825 security_state::SecurityStateModel::SecurityLevel security_level =
826 GetToolbarModel()->GetSecurityLevel(false); 826 GetToolbarModel()->GetSecurityLevel(false);
827 SkColor icon_color = 827 SkColor icon_color =
828 (security_level == security_state::SecurityStateModel::NONE) 828 (security_level == security_state::SecurityStateModel::NONE ||
829 security_level == security_state::SecurityStateModel::HTTP_SHOW_WARNING)
829 ? color_utils::DeriveDefaultIconColor(GetColor(TEXT)) 830 ? color_utils::DeriveDefaultIconColor(GetColor(TEXT))
830 : GetSecureTextColor(security_level); 831 : GetSecureTextColor(security_level);
831 location_icon_view_->SetImage(gfx::CreateVectorIcon( 832 location_icon_view_->SetImage(gfx::CreateVectorIcon(
832 omnibox_view_->GetVectorIcon(), kIconWidth, icon_color)); 833 omnibox_view_->GetVectorIcon(), kIconWidth, icon_color));
833 } 834 }
834 835
835 bool LocationBarView::RefreshContentSettingViews() { 836 bool LocationBarView::RefreshContentSettingViews() {
836 bool visibility_changed = false; 837 bool visibility_changed = false;
837 for (ContentSettingViews::const_iterator i(content_setting_views_.begin()); 838 for (ContentSettingViews::const_iterator i(content_setting_views_.begin());
838 i != content_setting_views_.end(); ++i) { 839 i != content_setting_views_.end(); ++i) {
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
1007 } 1008 }
1008 1009
1009 bool LocationBarView::ShouldShowEVBubble() const { 1010 bool LocationBarView::ShouldShowEVBubble() const {
1010 return (GetToolbarModel()->GetSecurityLevel(false) == 1011 return (GetToolbarModel()->GetSecurityLevel(false) ==
1011 security_state::SecurityStateModel::EV_SECURE) && 1012 security_state::SecurityStateModel::EV_SECURE) &&
1012 should_show_secure_state_; 1013 should_show_secure_state_;
1013 } 1014 }
1014 1015
1015 bool LocationBarView::ShouldShowSecurityChip() const { 1016 bool LocationBarView::ShouldShowSecurityChip() const {
1016 using SecurityLevel = security_state::SecurityStateModel::SecurityLevel; 1017 using SecurityLevel = security_state::SecurityStateModel::SecurityLevel;
1017 SecurityLevel level = GetToolbarModel()->GetSecurityLevel(false); 1018 const SecurityLevel level = GetToolbarModel()->GetSecurityLevel(false);
1018 return ((level == SecurityLevel::SECURE || 1019 if (level == SecurityLevel::SECURE || level == SecurityLevel::EV_SECURE)
1019 level == SecurityLevel::EV_SECURE) && 1020 return should_show_secure_state_;
1020 should_show_secure_state_) || 1021 return level == SecurityLevel::DANGEROUS ||
1021 level == SecurityLevel::DANGEROUS; 1022 level == SecurityLevel::HTTP_SHOW_WARNING;
1022 } 1023 }
1023 1024
1024 bool LocationBarView::ShouldAnimateSecurityChip() const { 1025 bool LocationBarView::ShouldAnimateSecurityChip() const {
1025 using SecurityLevel = security_state::SecurityStateModel::SecurityLevel; 1026 using SecurityLevel = security_state::SecurityStateModel::SecurityLevel;
1026 SecurityLevel level = GetToolbarModel()->GetSecurityLevel(false); 1027 SecurityLevel level = GetToolbarModel()->GetSecurityLevel(false);
1027 bool is_secure_level = 1028 if (!ShouldShowSecurityChip())
1028 level == SecurityLevel::EV_SECURE || level == SecurityLevel::SECURE; 1029 return false;
1029 return ShouldShowSecurityChip() && 1030 if (level == SecurityLevel::SECURE || level == SecurityLevel::EV_SECURE)
1030 ((level == SecurityLevel::DANGEROUS && 1031 return should_animate_secure_state_;
1031 should_animate_nonsecure_state_) || 1032 return should_animate_nonsecure_state_ &&
1032 (is_secure_level && should_animate_secure_state_)); 1033 (level == SecurityLevel::DANGEROUS ||
1034 level == SecurityLevel::HTTP_SHOW_WARNING);
1033 } 1035 }
1034 1036
1035 //////////////////////////////////////////////////////////////////////////////// 1037 ////////////////////////////////////////////////////////////////////////////////
1036 // LocationBarView, private LocationBar implementation: 1038 // LocationBarView, private LocationBar implementation:
1037 1039
1038 void LocationBarView::ShowFirstRunBubble() { 1040 void LocationBarView::ShowFirstRunBubble() {
1039 // Wait until search engines have loaded to show the first run bubble. 1041 // Wait until search engines have loaded to show the first run bubble.
1040 TemplateURLService* url_service = 1042 TemplateURLService* url_service =
1041 TemplateURLServiceFactory::GetForProfile(profile()); 1043 TemplateURLServiceFactory::GetForProfile(profile());
1042 if (!url_service->loaded()) { 1044 if (!url_service->loaded()) {
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after
1340 // LocationBarView, private TemplateURLServiceObserver implementation: 1342 // LocationBarView, private TemplateURLServiceObserver implementation:
1341 1343
1342 void LocationBarView::OnTemplateURLServiceChanged() { 1344 void LocationBarView::OnTemplateURLServiceChanged() {
1343 template_url_service_->RemoveObserver(this); 1345 template_url_service_->RemoveObserver(this);
1344 template_url_service_ = nullptr; 1346 template_url_service_ = nullptr;
1345 // If the browser is no longer active, let's not show the info bubble, as this 1347 // If the browser is no longer active, let's not show the info bubble, as this
1346 // would make the browser the active window again. 1348 // would make the browser the active window again.
1347 if (omnibox_view_ && omnibox_view_->GetWidget()->IsActive()) 1349 if (omnibox_view_ && omnibox_view_->GetWidget()->IsActive())
1348 ShowFirstRunBubble(); 1350 ShowFirstRunBubble();
1349 } 1351 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.mm ('k') | components/toolbar/toolbar_model_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698