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

Side by Side Diff: chrome/browser/ui/page_info/page_info.cc

Issue 2944253002: Do not pass by non-const reference in page_info.cc (Closed)
Patch Set: Created 3 years, 6 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/page_info/page_info.h" 5 #include "chrome/browser/ui/page_info/page_info.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <string> 10 #include <string>
(...skipping 146 matching lines...) Expand 10 before | Expand all | Expand 10 after
157 break; 157 break;
158 case security_state::CONTENT_STATUS_UNKNOWN: 158 case security_state::CONTENT_STATUS_UNKNOWN:
159 case security_state::CONTENT_STATUS_NONE: 159 case security_state::CONTENT_STATUS_NONE:
160 break; 160 break;
161 } 161 }
162 } 162 }
163 163
164 // If the |security_info| indicates that mixed content or certificate errors 164 // If the |security_info| indicates that mixed content or certificate errors
165 // were present, update |connection_status| and |connection_details|. 165 // were present, update |connection_status| and |connection_details|.
166 void ReportAnyInsecureContent(const security_state::SecurityInfo& security_info, 166 void ReportAnyInsecureContent(const security_state::SecurityInfo& security_info,
167 PageInfo::SiteConnectionStatus& connection_status, 167 PageInfo::SiteConnectionStatus* connection_status,
168 base::string16& connection_details) { 168 base::string16* connection_details) {
169 bool displayed_insecure_content = false; 169 bool displayed_insecure_content = false;
170 bool ran_insecure_content = false; 170 bool ran_insecure_content = false;
171 CheckContentStatus(security_info.mixed_content_status, 171 CheckContentStatus(security_info.mixed_content_status,
172 &displayed_insecure_content, &ran_insecure_content); 172 &displayed_insecure_content, &ran_insecure_content);
173 // Only note subresources with certificate errors if the main resource was 173 // Only note subresources with certificate errors if the main resource was
174 // loaded without major certificate errors. If the main resource had a 174 // loaded without major certificate errors. If the main resource had a
175 // certificate error, then it would not be that useful (and could 175 // certificate error, then it would not be that useful (and could
176 // potentially be confusing) to warn about subresources that had certificate 176 // potentially be confusing) to warn about subresources that had certificate
177 // errors too. 177 // errors too.
178 if (!net::IsCertStatusError(security_info.cert_status) || 178 if (!net::IsCertStatusError(security_info.cert_status) ||
179 net::IsCertStatusMinorError(security_info.cert_status)) { 179 net::IsCertStatusMinorError(security_info.cert_status)) {
180 CheckContentStatus(security_info.content_with_cert_errors_status, 180 CheckContentStatus(security_info.content_with_cert_errors_status,
181 &displayed_insecure_content, &ran_insecure_content); 181 &displayed_insecure_content, &ran_insecure_content);
182 } 182 }
183 183
184 // Only one insecure content warning is displayed; show the most severe. 184 // Only one insecure content warning is displayed; show the most severe.
185 if (ran_insecure_content) { 185 if (ran_insecure_content) {
186 connection_status = 186 *connection_status =
187 PageInfo::SITE_CONNECTION_STATUS_INSECURE_ACTIVE_SUBRESOURCE; 187 PageInfo::SITE_CONNECTION_STATUS_INSECURE_ACTIVE_SUBRESOURCE;
188 connection_details.assign(l10n_util::GetStringFUTF16( 188 connection_details->assign(l10n_util::GetStringFUTF16(
189 IDS_PAGE_INFO_SECURITY_TAB_ENCRYPTED_SENTENCE_LINK, connection_details, 189 IDS_PAGE_INFO_SECURITY_TAB_ENCRYPTED_SENTENCE_LINK, *connection_details,
190 l10n_util::GetStringUTF16( 190 l10n_util::GetStringUTF16(
191 IDS_PAGE_INFO_SECURITY_TAB_ENCRYPTED_INSECURE_CONTENT_ERROR))); 191 IDS_PAGE_INFO_SECURITY_TAB_ENCRYPTED_INSECURE_CONTENT_ERROR)));
192 return; 192 return;
193 } 193 }
194 if (security_info.contained_mixed_form) { 194 if (security_info.contained_mixed_form) {
195 connection_status = PageInfo::SITE_CONNECTION_STATUS_INSECURE_FORM_ACTION; 195 *connection_status = PageInfo::SITE_CONNECTION_STATUS_INSECURE_FORM_ACTION;
196 connection_details.assign(l10n_util::GetStringFUTF16( 196 connection_details->assign(l10n_util::GetStringFUTF16(
197 IDS_PAGE_INFO_SECURITY_TAB_ENCRYPTED_SENTENCE_LINK, connection_details, 197 IDS_PAGE_INFO_SECURITY_TAB_ENCRYPTED_SENTENCE_LINK, *connection_details,
198 l10n_util::GetStringUTF16( 198 l10n_util::GetStringUTF16(
199 IDS_PAGE_INFO_SECURITY_TAB_ENCRYPTED_INSECURE_FORM_WARNING))); 199 IDS_PAGE_INFO_SECURITY_TAB_ENCRYPTED_INSECURE_FORM_WARNING)));
200 return; 200 return;
201 } 201 }
202 if (displayed_insecure_content) { 202 if (displayed_insecure_content) {
203 connection_status = 203 *connection_status =
204 PageInfo::SITE_CONNECTION_STATUS_INSECURE_PASSIVE_SUBRESOURCE; 204 PageInfo::SITE_CONNECTION_STATUS_INSECURE_PASSIVE_SUBRESOURCE;
205 connection_details.assign(l10n_util::GetStringFUTF16( 205 connection_details->assign(l10n_util::GetStringFUTF16(
206 IDS_PAGE_INFO_SECURITY_TAB_ENCRYPTED_SENTENCE_LINK, connection_details, 206 IDS_PAGE_INFO_SECURITY_TAB_ENCRYPTED_SENTENCE_LINK, *connection_details,
207 l10n_util::GetStringUTF16( 207 l10n_util::GetStringUTF16(
208 IDS_PAGE_INFO_SECURITY_TAB_ENCRYPTED_INSECURE_CONTENT_WARNING))); 208 IDS_PAGE_INFO_SECURITY_TAB_ENCRYPTED_INSECURE_CONTENT_WARNING)));
209 } 209 }
210 } 210 }
211 211
212 void GetSiteIdentityByMaliciousContentStatus( 212 void GetSiteIdentityByMaliciousContentStatus(
213 security_state::MaliciousContentStatus malicious_content_status, 213 security_state::MaliciousContentStatus malicious_content_status,
214 PageInfo::SiteIdentityStatus* status, 214 PageInfo::SiteIdentityStatus* status,
215 base::string16* details) { 215 base::string16* details) {
216 switch (malicious_content_status) { 216 switch (malicious_content_status) {
(...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after
630 630
631 if (security_info.obsolete_ssl_status == net::OBSOLETE_SSL_NONE) { 631 if (security_info.obsolete_ssl_status == net::OBSOLETE_SSL_NONE) {
632 site_connection_details_.assign(l10n_util::GetStringFUTF16( 632 site_connection_details_.assign(l10n_util::GetStringFUTF16(
633 IDS_PAGE_INFO_SECURITY_TAB_ENCRYPTED_CONNECTION_TEXT, subject_name)); 633 IDS_PAGE_INFO_SECURITY_TAB_ENCRYPTED_CONNECTION_TEXT, subject_name));
634 } else { 634 } else {
635 site_connection_details_.assign(l10n_util::GetStringFUTF16( 635 site_connection_details_.assign(l10n_util::GetStringFUTF16(
636 IDS_PAGE_INFO_SECURITY_TAB_WEAK_ENCRYPTION_CONNECTION_TEXT, 636 IDS_PAGE_INFO_SECURITY_TAB_WEAK_ENCRYPTION_CONNECTION_TEXT,
637 subject_name)); 637 subject_name));
638 } 638 }
639 639
640 ReportAnyInsecureContent(security_info, site_connection_status_, 640 ReportAnyInsecureContent(security_info, &site_connection_status_,
641 site_connection_details_); 641 &site_connection_details_);
642 } 642 }
643 643
644 uint16_t cipher_suite = 644 uint16_t cipher_suite =
645 net::SSLConnectionStatusToCipherSuite(security_info.connection_status); 645 net::SSLConnectionStatusToCipherSuite(security_info.connection_status);
646 if (security_info.security_bits > 0 && cipher_suite) { 646 if (security_info.security_bits > 0 && cipher_suite) {
647 int ssl_version = 647 int ssl_version =
648 net::SSLConnectionStatusToVersion(security_info.connection_status); 648 net::SSLConnectionStatusToVersion(security_info.connection_status);
649 const char* ssl_version_str; 649 const char* ssl_version_str;
650 net::SSLVersionToString(&ssl_version_str, ssl_version); 650 net::SSLVersionToString(&ssl_version_str, ssl_version);
651 site_connection_details_ += ASCIIToUTF16("\n\n"); 651 site_connection_details_ += ASCIIToUTF16("\n\n");
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
800 info.site_identity = UTF16ToUTF8(GetSimpleSiteName(site_url_)); 800 info.site_identity = UTF16ToUTF8(GetSimpleSiteName(site_url_));
801 801
802 info.connection_status = site_connection_status_; 802 info.connection_status = site_connection_status_;
803 info.connection_status_description = UTF16ToUTF8(site_connection_details_); 803 info.connection_status_description = UTF16ToUTF8(site_connection_details_);
804 info.identity_status = site_identity_status_; 804 info.identity_status = site_identity_status_;
805 info.identity_status_description = UTF16ToUTF8(site_identity_details_); 805 info.identity_status_description = UTF16ToUTF8(site_identity_details_);
806 info.certificate = certificate_; 806 info.certificate = certificate_;
807 info.show_ssl_decision_revoke_button = show_ssl_decision_revoke_button_; 807 info.show_ssl_decision_revoke_button = show_ssl_decision_revoke_button_;
808 ui_->SetIdentityInfo(info); 808 ui_->SetIdentityInfo(info);
809 } 809 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698