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

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

Issue 2351003003: [omnibox] Support new flags for security chip (Closed)
Patch Set: Created 4 years, 3 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 1946e31d9e4283e5262bb20c56dfe63b8408d7ef..3eb2653a326cf1b3d5fca484dd2653d6118ee83b 100644
--- a/chrome/browser/ui/views/location_bar/location_bar_view.cc
+++ b/chrome/browser/ui/views/location_bar/location_bar_view.cc
@@ -7,6 +7,7 @@
#include <algorithm>
#include <map>
+#include "base/command_line.h"
#include "base/i18n/rtl.h"
#include "base/stl_util.h"
#include "base/strings/utf_string_conversions.h"
@@ -51,6 +52,7 @@
#include "chrome/browser/ui/views/passwords/manage_passwords_icon_views.h"
#include "chrome/browser/ui/views/translate/translate_bubble_view.h"
#include "chrome/browser/ui/views/translate/translate_icon_view.h"
+#include "chrome/common/chrome_switches.h"
#include "chrome/grit/generated_resources.h"
#include "chrome/grit/theme_resources.h"
#include "components/bookmarks/common/bookmark_pref_names.h"
@@ -138,7 +140,9 @@ LocationBarView::LocationBarView(Browser* browser,
is_popup_mode_(is_popup_mode),
show_focus_rect_(false),
template_url_service_(NULL),
- web_contents_null_at_last_refresh_(true) {
+ web_contents_null_at_last_refresh_(true),
+ should_show_secure_state_(true),
+ should_animate_secure_state_(true) {
edit_bookmarks_enabled_.Init(
bookmarks::prefs::kEditBookmarksEnabled, profile->GetPrefs(),
base::Bind(&LocationBarView::UpdateWithoutTabRestore,
@@ -146,6 +150,24 @@ LocationBarView::LocationBarView(Browser* browser,
zoom::ZoomEventManager::GetForBrowserContext(profile)
->AddZoomEventManagerObserver(this);
+
+ base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
+ if (command_line->HasSwitch(switches::kMaterialSecurityVerbose)) {
+ std::string security_verbose_flag =
+ command_line->GetSwitchValueASCII(switches::kMaterialSecurityVerbose);
+
+ should_show_secure_state_ =
+ security_verbose_flag ==
+ switches::kMaterialSecurityVerboseShowAllAnimated ||
+ security_verbose_flag ==
+ switches::kMaterialSecurityVerboseShowAllNonAnimated;
+
+ should_animate_secure_state_ =
+ security_verbose_flag ==
+ switches::kMaterialSecurityVerboseShowAllAnimated ||
+ security_verbose_flag ==
+ switches::kMaterialSecurityVerboseShowNonSecureAnimated;
+ }
}
LocationBarView::~LocationBarView() {
@@ -803,7 +825,8 @@ void LocationBarView::Update(const WebContents* contents) {
omnibox_view_->Update();
bool should_show = ShouldShowSecurityChip();
- location_icon_view_->SetSecurityState(should_show, should_show && !contents);
+ location_icon_view_->SetSecurityState(
+ should_show, should_show && !contents && should_animate_secure_state_);
OnChanged(); // NOTE: Calls Layout().
}
@@ -1049,13 +1072,16 @@ bool LocationBarView::ShouldShowKeywordBubble() const {
bool LocationBarView::ShouldShowEVBubble() const {
return (GetToolbarModel()->GetSecurityLevel(false) ==
- security_state::SecurityStateModel::EV_SECURE);
+ 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 ||
+ return ((level == SecurityLevel::SECURE ||
+ level == SecurityLevel::EV_SECURE) &&
+ should_show_secure_state_) ||
level == SecurityLevel::SECURITY_ERROR;
}

Powered by Google App Engine
This is Rietveld 408576698