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

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

Issue 2431223007: [Views][Mac] Security Chip Default Value (Closed)
Patch Set: 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/views/location_bar/location_bar_view.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 30b042900c091b79ae35d0faa6c0d6a74ef22feb..8bae558b608f5527a262d8370e7d7c0c3b8b2f53 100644
--- a/chrome/browser/ui/views/location_bar/location_bar_view.cc
+++ b/chrome/browser/ui/views/location_bar/location_bar_view.cc
@@ -140,8 +140,9 @@ LocationBarView::LocationBarView(Browser* browser,
show_focus_rect_(false),
template_url_service_(NULL),
web_contents_null_at_last_refresh_(true),
- should_show_secure_state_(true),
- should_animate_secure_state_(true) {
+ should_show_secure_state_(false),
+ should_show_nonsecure_state_(false),
+ should_animate_secure_state_(false) {
edit_bookmarks_enabled_.Init(
bookmarks::prefs::kEditBookmarksEnabled, profile->GetPrefs(),
base::Bind(&LocationBarView::UpdateWithoutTabRestore,
@@ -154,13 +155,12 @@ LocationBarView::LocationBarView(Browser* browser,
if (command_line->HasSwitch(switches::kMaterialSecurityVerbose)) {
std::string security_verbose_flag =
command_line->GetSwitchValueASCII(switches::kMaterialSecurityVerbose);
-
+ should_show_nonsecure_state_ = true;
should_show_secure_state_ =
security_verbose_flag ==
switches::kMaterialSecurityVerboseShowAllAnimated ||
security_verbose_flag ==
switches::kMaterialSecurityVerboseShowAllNonAnimated;
-
should_animate_secure_state_ =
security_verbose_flag ==
switches::kMaterialSecurityVerboseShowAllAnimated ||
@@ -995,8 +995,10 @@ bool LocationBarView::HasValidSuggestText() const {
}
base::string16 LocationBarView::GetSecurityText() const {
- return ShouldShowEVBubble() ? GetToolbarModel()->GetEVCertName()
- : GetToolbarModel()->GetSecureVerboseText();
+ bool has_ev_cert = (GetToolbarModel()->GetSecurityLevel(false) ==
+ security_state::SecurityStateModel::EV_SECURE);
+ return has_ev_cert ? GetToolbarModel()->GetEVCertName()
+ : GetToolbarModel()->GetSecureVerboseText();
}
bool LocationBarView::ShouldShowKeywordBubble() const {
@@ -1004,19 +1006,17 @@ bool LocationBarView::ShouldShowKeywordBubble() const {
!omnibox_view_->model()->is_keyword_hint();
}
-bool LocationBarView::ShouldShowEVBubble() const {
- return (GetToolbarModel()->GetSecurityLevel(false) ==
- security_state::SecurityStateModel::EV_SECURE) &&
- should_show_secure_state_;
-}
-
bool LocationBarView::ShouldShowSecurityChip() const {
using SecurityLevel = security_state::SecurityStateModel::SecurityLevel;
- SecurityLevel level = GetToolbarModel()->GetSecurityLevel(false);
- return ((level == SecurityLevel::SECURE ||
- level == SecurityLevel::EV_SECURE) &&
- should_show_secure_state_) ||
- level == SecurityLevel::DANGEROUS;
+ const SecurityLevel level = GetToolbarModel()->GetSecurityLevel(false);
+ if (level == SecurityLevel::EV_SECURE) {
+ return true;
+ } else if (level == SecurityLevel::SECURE) {
+ return should_show_secure_state_;
+ } else {
+ return should_show_nonsecure_state_ &&
+ level == SecurityLevel::DANGEROUS;
+ }
}
////////////////////////////////////////////////////////////////////////////////
« no previous file with comments | « chrome/browser/ui/views/location_bar/location_bar_view.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698