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

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

Issue 2560203003: Remove SecurityChips experiment and flags (Closed)
Patch Set: fix rebase conflict mishap Created 4 years 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 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 zoom_view_(nullptr), 133 zoom_view_(nullptr),
134 open_pdf_in_reader_view_(nullptr), 134 open_pdf_in_reader_view_(nullptr),
135 manage_passwords_icon_view_(nullptr), 135 manage_passwords_icon_view_(nullptr),
136 save_credit_card_icon_view_(nullptr), 136 save_credit_card_icon_view_(nullptr),
137 translate_icon_view_(nullptr), 137 translate_icon_view_(nullptr),
138 star_view_(nullptr), 138 star_view_(nullptr),
139 size_animation_(this), 139 size_animation_(this),
140 is_popup_mode_(is_popup_mode), 140 is_popup_mode_(is_popup_mode),
141 show_focus_rect_(false), 141 show_focus_rect_(false),
142 template_url_service_(NULL), 142 template_url_service_(NULL),
143 web_contents_null_at_last_refresh_(true), 143 web_contents_null_at_last_refresh_(true) {
144 should_show_secure_state_(false),
145 should_show_nonsecure_state_(false),
146 should_animate_secure_state_(false),
147 should_animate_nonsecure_state_(false) {
148 edit_bookmarks_enabled_.Init( 144 edit_bookmarks_enabled_.Init(
149 bookmarks::prefs::kEditBookmarksEnabled, profile->GetPrefs(), 145 bookmarks::prefs::kEditBookmarksEnabled, profile->GetPrefs(),
150 base::Bind(&LocationBarView::UpdateWithoutTabRestore, 146 base::Bind(&LocationBarView::UpdateWithoutTabRestore,
151 base::Unretained(this))); 147 base::Unretained(this)));
152 148
153 zoom::ZoomEventManager::GetForBrowserContext(profile) 149 zoom::ZoomEventManager::GetForBrowserContext(profile)
154 ->AddZoomEventManagerObserver(this); 150 ->AddZoomEventManagerObserver(this);
155
156 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
Peter Kasting 2016/12/10 02:36:38 Nit: See if relevant #includes (command_line.h, ch
estark 2016/12/14 17:54:28 Done; removed command_line.h, chrome_switches.h, c
157 std::string security_chip_visibility;
158 if (command_line->HasSwitch(switches::kSecurityChip)) {
159 security_chip_visibility =
160 command_line->GetSwitchValueASCII(switches::kSecurityChip);
161 } else if (base::FeatureList::IsEnabled(features::kSecurityChip)) {
162 security_chip_visibility =
163 variations::GetVariationParamValueByFeature(
164 features::kSecurityChip, kSecurityChipFeatureVisibilityParam);
165 }
166
167 should_show_secure_state_ =
168 security_chip_visibility == switches::kSecurityChipShowAll;
169 should_show_nonsecure_state_ =
170 should_show_secure_state_ ||
171 security_chip_visibility == switches::kSecurityChipShowNonSecureOnly;
172
173 std::string security_chip_animation;
174 if (command_line->HasSwitch(switches::kSecurityChipAnimation)) {
175 security_chip_animation =
176 command_line->GetSwitchValueASCII(switches::kSecurityChipAnimation);
177 } else if (base::FeatureList::IsEnabled(features::kSecurityChip)) {
178 security_chip_animation = variations::GetVariationParamValueByFeature(
179 features::kSecurityChip, kSecurityChipFeatureAnimationParam);
180 }
181
182 should_animate_secure_state_ =
183 security_chip_animation == switches::kSecurityChipAnimationAll;
184 should_animate_nonsecure_state_ =
185 should_animate_secure_state_ ||
186 security_chip_animation == switches::kSecurityChipAnimationNonSecureOnly;
187 } 151 }
188 152
189 LocationBarView::~LocationBarView() { 153 LocationBarView::~LocationBarView() {
190 if (template_url_service_) 154 if (template_url_service_)
191 template_url_service_->RemoveObserver(this); 155 template_url_service_->RemoveObserver(this);
192 156
193 zoom::ZoomEventManager::GetForBrowserContext(profile()) 157 zoom::ZoomEventManager::GetForBrowserContext(profile())
194 ->RemoveZoomEventManagerObserver(this); 158 ->RemoveZoomEventManagerObserver(this);
195 } 159 }
196 160
(...skipping 727 matching lines...) Expand 10 before | Expand all | Expand 10 after
924 } 888 }
925 889
926 bool LocationBarView::ShouldShowKeywordBubble() const { 890 bool LocationBarView::ShouldShowKeywordBubble() const {
927 return !omnibox_view_->model()->keyword().empty() && 891 return !omnibox_view_->model()->keyword().empty() &&
928 !omnibox_view_->model()->is_keyword_hint(); 892 !omnibox_view_->model()->is_keyword_hint();
929 } 893 }
930 894
931 bool LocationBarView::ShouldShowSecurityChip() const { 895 bool LocationBarView::ShouldShowSecurityChip() const {
932 using SecurityLevel = security_state::SecurityLevel; 896 using SecurityLevel = security_state::SecurityLevel;
933 const SecurityLevel level = GetToolbarModel()->GetSecurityLevel(false); 897 const SecurityLevel level = GetToolbarModel()->GetSecurityLevel(false);
934 if (level == SecurityLevel::EV_SECURE) { 898 return level == SecurityLevel::EV_SECURE || level == SecurityLevel::SECURE ||
935 return true; 899 level == SecurityLevel::DANGEROUS ||
936 } else if (level == SecurityLevel::SECURE) { 900 level == SecurityLevel::HTTP_SHOW_WARNING;
937 return should_show_secure_state_;
938 } else {
939 return should_show_nonsecure_state_ &&
940 (level == SecurityLevel::DANGEROUS ||
941 level == SecurityLevel::HTTP_SHOW_WARNING);
942 }
943 } 901 }
944 902
945 bool LocationBarView::ShouldAnimateSecurityChip() const { 903 bool LocationBarView::ShouldAnimateSecurityChip() const {
946 using SecurityLevel = security_state::SecurityLevel; 904 using SecurityLevel = security_state::SecurityLevel;
947 SecurityLevel level = GetToolbarModel()->GetSecurityLevel(false); 905 SecurityLevel level = GetToolbarModel()->GetSecurityLevel(false);
948 if (!ShouldShowSecurityChip()) 906 if (!ShouldShowSecurityChip())
949 return false; 907 return false;
Peter Kasting 2016/12/10 02:36:38 Nit: This conditional can disappear entirely.
estark 2016/12/14 17:54:28 Done.
950 if (level == SecurityLevel::SECURE || level == SecurityLevel::EV_SECURE) 908 return level == SecurityLevel::DANGEROUS ||
951 return should_animate_secure_state_; 909 level == SecurityLevel::HTTP_SHOW_WARNING;
952 return should_animate_nonsecure_state_ &&
953 (level == SecurityLevel::DANGEROUS ||
954 level == SecurityLevel::HTTP_SHOW_WARNING);
955 } 910 }
956 911
957 //////////////////////////////////////////////////////////////////////////////// 912 ////////////////////////////////////////////////////////////////////////////////
958 // LocationBarView, private LocationBar implementation: 913 // LocationBarView, private LocationBar implementation:
959 914
960 void LocationBarView::ShowFirstRunBubble() { 915 void LocationBarView::ShowFirstRunBubble() {
961 // Wait until search engines have loaded to show the first run bubble. 916 // Wait until search engines have loaded to show the first run bubble.
962 TemplateURLService* url_service = 917 TemplateURLService* url_service =
963 TemplateURLServiceFactory::GetForProfile(profile()); 918 TemplateURLServiceFactory::GetForProfile(profile());
964 if (!url_service->loaded()) { 919 if (!url_service->loaded()) {
(...skipping 296 matching lines...) Expand 10 before | Expand all | Expand 10 after
1261 // LocationBarView, private TemplateURLServiceObserver implementation: 1216 // LocationBarView, private TemplateURLServiceObserver implementation:
1262 1217
1263 void LocationBarView::OnTemplateURLServiceChanged() { 1218 void LocationBarView::OnTemplateURLServiceChanged() {
1264 template_url_service_->RemoveObserver(this); 1219 template_url_service_->RemoveObserver(this);
1265 template_url_service_ = nullptr; 1220 template_url_service_ = nullptr;
1266 // If the browser is no longer active, let's not show the info bubble, as this 1221 // If the browser is no longer active, let's not show the info bubble, as this
1267 // would make the browser the active window again. 1222 // would make the browser the active window again.
1268 if (omnibox_view_ && omnibox_view_->GetWidget()->IsActive()) 1223 if (omnibox_view_ && omnibox_view_->GetWidget()->IsActive())
1269 ShowFirstRunBubble(); 1224 ShowFirstRunBubble();
1270 } 1225 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/location_bar/location_bar_view.h ('k') | chrome/common/chrome_features.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698