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

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

Issue 2378623007: [Material] Update Material Security Verbose Decoration Flag (Closed)
Patch Set: Rebased 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 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
134 manage_passwords_icon_view_(nullptr), 134 manage_passwords_icon_view_(nullptr),
135 save_credit_card_icon_view_(nullptr), 135 save_credit_card_icon_view_(nullptr),
136 translate_icon_view_(nullptr), 136 translate_icon_view_(nullptr),
137 star_view_(nullptr), 137 star_view_(nullptr),
138 size_animation_(this), 138 size_animation_(this),
139 is_popup_mode_(is_popup_mode), 139 is_popup_mode_(is_popup_mode),
140 show_focus_rect_(false), 140 show_focus_rect_(false),
141 template_url_service_(NULL), 141 template_url_service_(NULL),
142 web_contents_null_at_last_refresh_(true), 142 web_contents_null_at_last_refresh_(true),
143 should_show_secure_state_(true), 143 should_show_secure_state_(true),
144 should_animate_secure_state_(true) { 144 should_animate_secure_state_(false),
145 should_animate_nonsecure_state_(false) {
145 edit_bookmarks_enabled_.Init( 146 edit_bookmarks_enabled_.Init(
146 bookmarks::prefs::kEditBookmarksEnabled, profile->GetPrefs(), 147 bookmarks::prefs::kEditBookmarksEnabled, profile->GetPrefs(),
147 base::Bind(&LocationBarView::UpdateWithoutTabRestore, 148 base::Bind(&LocationBarView::UpdateWithoutTabRestore,
148 base::Unretained(this))); 149 base::Unretained(this)));
149 150
150 zoom::ZoomEventManager::GetForBrowserContext(profile) 151 zoom::ZoomEventManager::GetForBrowserContext(profile)
151 ->AddZoomEventManagerObserver(this); 152 ->AddZoomEventManagerObserver(this);
152 153
153 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); 154 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
154 if (command_line->HasSwitch(switches::kMaterialSecurityVerbose)) { 155 if (command_line->HasSwitch(switches::kSecurityVerboseDecoration)) {
155 std::string security_verbose_flag = 156 std::string security_verbose_flag =
156 command_line->GetSwitchValueASCII(switches::kMaterialSecurityVerbose); 157 command_line->GetSwitchValueASCII(switches::kSecurityVerboseDecoration);
157 158
158 should_show_secure_state_ = 159 should_show_secure_state_ =
159 security_verbose_flag == 160 security_verbose_flag ==
160 switches::kMaterialSecurityVerboseShowAllAnimated || 161 switches::kSecurityVerboseDecorationShowAllAnimated ||
161 security_verbose_flag == 162 security_verbose_flag ==
162 switches::kMaterialSecurityVerboseShowAllNonAnimated; 163 switches::kSecurityVerboseDecorationShowAllNonAnimated ||
164 security_verbose_flag ==
165 switches::
166 kSecurityVerboseDecorationShowAllWithOnlyNonSecureAnimated;
163 167
164 should_animate_secure_state_ = 168 should_animate_secure_state_ =
165 security_verbose_flag == 169 security_verbose_flag ==
166 switches::kMaterialSecurityVerboseShowAllAnimated || 170 switches::kSecurityVerboseDecorationShowAllAnimated;
171
172 should_animate_nonsecure_state_ =
167 security_verbose_flag == 173 security_verbose_flag ==
168 switches::kMaterialSecurityVerboseShowNonSecureAnimated; 174 switches::kSecurityVerboseDecorationShowAllAnimated ||
175 security_verbose_flag ==
176 switches::kSecurityVerboseDecorationShowNonSecureAnimated ||
177 security_verbose_flag ==
178 switches::
179 kSecurityVerboseDecorationShowAllWithOnlyNonSecureAnimated;
169 } 180 }
170 } 181 }
171 182
172 LocationBarView::~LocationBarView() { 183 LocationBarView::~LocationBarView() {
173 if (template_url_service_) 184 if (template_url_service_)
174 template_url_service_->RemoveObserver(this); 185 template_url_service_->RemoveObserver(this);
175 186
176 zoom::ZoomEventManager::GetForBrowserContext(profile()) 187 zoom::ZoomEventManager::GetForBrowserContext(profile())
177 ->RemoveZoomEventManagerObserver(this); 188 ->RemoveZoomEventManagerObserver(this);
178 } 189 }
(...skipping 584 matching lines...) Expand 10 before | Expand all | Expand 10 after
763 open_pdf_in_reader_view_->Update(web_contents_for_sub_views); 774 open_pdf_in_reader_view_->Update(web_contents_for_sub_views);
764 775
765 if (star_view_) 776 if (star_view_)
766 UpdateBookmarkStarVisibility(); 777 UpdateBookmarkStarVisibility();
767 778
768 if (contents) 779 if (contents)
769 omnibox_view_->OnTabChanged(contents); 780 omnibox_view_->OnTabChanged(contents);
770 else 781 else
771 omnibox_view_->Update(); 782 omnibox_view_->Update();
772 783
773 bool should_show = ShouldShowSecurityChip(); 784 bool should_show = ShouldShowSecurityChip();
Kevin Bailey 2016/10/04 15:10:17 You'll need Peter's approval for this file, but sp
spqchan 2016/10/05 01:39:49 Sounds good, I'll add pkasting. I wanted to get a
774 location_icon_view_->SetSecurityState( 785
775 should_show, should_show && !contents && should_animate_secure_state_); 786 security_state::SecurityStateModel::SecurityLevel security_level =
787 GetToolbarModel()->GetSecurityLevel(false);
788 bool is_secure_level =
789 security_level == security_state::SecurityStateModel::EV_SECURE ||
790 security_level == security_state::SecurityStateModel::SECURE;
791 bool should_animate =
792 should_show && !contents &&
793 ((security_level == security_state::SecurityStateModel::DANGEROUS &&
794 should_animate_nonsecure_state_) ||
795 (is_secure_level && should_animate_secure_state_));
796
797 location_icon_view_->SetSecurityState(should_show, should_animate);
776 798
777 OnChanged(); // NOTE: Calls Layout(). 799 OnChanged(); // NOTE: Calls Layout().
778 } 800 }
779 801
780 void LocationBarView::ResetTabState(WebContents* contents) { 802 void LocationBarView::ResetTabState(WebContents* contents) {
781 omnibox_view_->ResetTabState(contents); 803 omnibox_view_->ResetTabState(contents);
782 } 804 }
783 805
784 //////////////////////////////////////////////////////////////////////////////// 806 ////////////////////////////////////////////////////////////////////////////////
785 // LocationBarView, public OmniboxEditController implementation: 807 // LocationBarView, public OmniboxEditController implementation:
(...skipping 541 matching lines...) Expand 10 before | Expand all | Expand 10 after
1327 // LocationBarView, private TemplateURLServiceObserver implementation: 1349 // LocationBarView, private TemplateURLServiceObserver implementation:
1328 1350
1329 void LocationBarView::OnTemplateURLServiceChanged() { 1351 void LocationBarView::OnTemplateURLServiceChanged() {
1330 template_url_service_->RemoveObserver(this); 1352 template_url_service_->RemoveObserver(this);
1331 template_url_service_ = nullptr; 1353 template_url_service_ = nullptr;
1332 // If the browser is no longer active, let's not show the info bubble, as this 1354 // If the browser is no longer active, let's not show the info bubble, as this
1333 // would make the browser the active window again. 1355 // would make the browser the active window again.
1334 if (omnibox_view_ && omnibox_view_->GetWidget()->IsActive()) 1356 if (omnibox_view_ && omnibox_view_->GetWidget()->IsActive())
1335 ShowFirstRunBubble(); 1357 ShowFirstRunBubble();
1336 } 1358 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/views/location_bar/location_bar_view.h ('k') | chrome/common/chrome_switches.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698