OLD | NEW |
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/website_settings/website_settings.h" | 5 #include "chrome/browser/ui/website_settings/website_settings.h" |
6 | 6 |
7 #include <openssl/ssl.h> | 7 #include <openssl/ssl.h> |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 #include <stdint.h> | 9 #include <stdint.h> |
10 | 10 |
(...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
282 | 282 |
283 WebsiteSettings::~WebsiteSettings() { | 283 WebsiteSettings::~WebsiteSettings() { |
284 } | 284 } |
285 | 285 |
286 void WebsiteSettings::RecordWebsiteSettingsAction( | 286 void WebsiteSettings::RecordWebsiteSettingsAction( |
287 WebsiteSettingsAction action) { | 287 WebsiteSettingsAction action) { |
288 UMA_HISTOGRAM_ENUMERATION("WebsiteSettings.Action", | 288 UMA_HISTOGRAM_ENUMERATION("WebsiteSettings.Action", |
289 action, | 289 action, |
290 WEBSITE_SETTINGS_COUNT); | 290 WEBSITE_SETTINGS_COUNT); |
291 | 291 |
292 // Use a separate histogram to record actions if they are done on a page with | 292 std::string histogram_name; |
293 // an HTTPS URL. Note that this *disregards* security status. | |
294 // | |
295 | 293 |
296 // TODO(palmer): Consider adding a new histogram for | 294 if (site_url_.SchemeIsCryptographic()) { |
297 // GURL::SchemeIsCryptographic. (We don't want to replace this call with a | 295 if (security_level_ == security_state::SecurityStateModel::SECURE) { |
298 // call to that function because we don't want to change the meanings of | 296 UMA_HISTOGRAM_ENUMERATION("PageInfo.Action.HttpsUrl2", action, |
299 // existing metrics.) This would inform the decision to mark non-secure | 297 WEBSITE_SETTINGS_COUNT); |
300 // origins as Dubious or Non-Secure; the overall bug for that is | 298 } else if (security_level_ == security_state::SecurityStateModel::NONE) { |
301 // crbug.com/454579. | 299 UMA_HISTOGRAM_ENUMERATION("PageInfo.Action.HttpsUrlDowngraded", action, |
302 if (site_url_.SchemeIs(url::kHttpsScheme)) { | 300 WEBSITE_SETTINGS_COUNT); |
303 UMA_HISTOGRAM_ENUMERATION("WebsiteSettings.Action.HttpsUrl", | 301 } else if (security_level_ == |
304 action, | 302 security_state::SecurityStateModel::DANGEROUS) { |
| 303 UMA_HISTOGRAM_ENUMERATION("PageInfo.Action.HttpsUrlDangerous", action, |
| 304 WEBSITE_SETTINGS_COUNT); |
| 305 } |
| 306 return; |
| 307 } |
| 308 |
| 309 if (security_level_ == |
| 310 security_state::SecurityStateModel::HTTP_SHOW_WARNING) { |
| 311 UMA_HISTOGRAM_ENUMERATION("PageInfo.Action.HttpWarning", action, |
| 312 WEBSITE_SETTINGS_COUNT); |
| 313 } else if (security_level_ == security_state::SecurityStateModel::DANGEROUS) { |
| 314 UMA_HISTOGRAM_ENUMERATION("PageInfo.Action.HttpUrlDangerous", action, |
305 WEBSITE_SETTINGS_COUNT); | 315 WEBSITE_SETTINGS_COUNT); |
306 } | 316 } |
307 } | 317 } |
308 | 318 |
309 void WebsiteSettings::OnSitePermissionChanged(ContentSettingsType type, | 319 void WebsiteSettings::OnSitePermissionChanged(ContentSettingsType type, |
310 ContentSetting setting) { | 320 ContentSetting setting) { |
311 // Count how often a permission for a specific content type is changed using | 321 // Count how often a permission for a specific content type is changed using |
312 // the Website Settings UI. | 322 // the Website Settings UI. |
313 size_t num_values; | 323 size_t num_values; |
314 int histogram_value = ContentSettingTypeToHistogramValue(type, &num_values); | 324 int histogram_value = ContentSettingTypeToHistogramValue(type, &num_values); |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
405 !url.SchemeIs(content::kChromeDevToolsScheme) && | 415 !url.SchemeIs(content::kChromeDevToolsScheme) && |
406 !url.SchemeIs(content::kViewSourceScheme) && | 416 !url.SchemeIs(content::kViewSourceScheme) && |
407 !url.SchemeIs(content_settings::kExtensionScheme)); | 417 !url.SchemeIs(content_settings::kExtensionScheme)); |
408 #endif | 418 #endif |
409 | 419 |
410 bool isChromeUINativeScheme = false; | 420 bool isChromeUINativeScheme = false; |
411 #if BUILDFLAG(ANDROID_JAVA_UI) | 421 #if BUILDFLAG(ANDROID_JAVA_UI) |
412 isChromeUINativeScheme = url.SchemeIs(chrome::kChromeUINativeScheme); | 422 isChromeUINativeScheme = url.SchemeIs(chrome::kChromeUINativeScheme); |
413 #endif | 423 #endif |
414 | 424 |
| 425 security_level_ = security_info.security_level; |
| 426 |
415 if (url.SchemeIs(url::kAboutScheme)) { | 427 if (url.SchemeIs(url::kAboutScheme)) { |
416 // All about: URLs except about:blank are redirected. | 428 // All about: URLs except about:blank are redirected. |
417 DCHECK_EQ(url::kAboutBlankURL, url.spec()); | 429 DCHECK_EQ(url::kAboutBlankURL, url.spec()); |
418 site_identity_status_ = SITE_IDENTITY_STATUS_NO_CERT; | 430 site_identity_status_ = SITE_IDENTITY_STATUS_NO_CERT; |
419 site_identity_details_ = | 431 site_identity_details_ = |
420 l10n_util::GetStringUTF16(IDS_PAGE_INFO_SECURITY_TAB_INSECURE_IDENTITY); | 432 l10n_util::GetStringUTF16(IDS_PAGE_INFO_SECURITY_TAB_INSECURE_IDENTITY); |
421 site_connection_status_ = SITE_CONNECTION_STATUS_UNENCRYPTED; | 433 site_connection_status_ = SITE_CONNECTION_STATUS_UNENCRYPTED; |
422 site_connection_details_ = l10n_util::GetStringFUTF16( | 434 site_connection_details_ = l10n_util::GetStringFUTF16( |
423 IDS_PAGE_INFO_SECURITY_TAB_NOT_ENCRYPTED_CONNECTION_TEXT, | 435 IDS_PAGE_INFO_SECURITY_TAB_NOT_ENCRYPTED_CONNECTION_TEXT, |
424 UTF8ToUTF16(url.spec())); | 436 UTF8ToUTF16(url.spec())); |
(...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
820 info.connection_status = site_connection_status_; | 832 info.connection_status = site_connection_status_; |
821 info.connection_status_description = | 833 info.connection_status_description = |
822 UTF16ToUTF8(site_connection_details_); | 834 UTF16ToUTF8(site_connection_details_); |
823 info.identity_status = site_identity_status_; | 835 info.identity_status = site_identity_status_; |
824 info.identity_status_description = | 836 info.identity_status_description = |
825 UTF16ToUTF8(site_identity_details_); | 837 UTF16ToUTF8(site_identity_details_); |
826 info.certificate = certificate_; | 838 info.certificate = certificate_; |
827 info.show_ssl_decision_revoke_button = show_ssl_decision_revoke_button_; | 839 info.show_ssl_decision_revoke_button = show_ssl_decision_revoke_button_; |
828 ui_->SetIdentityInfo(info); | 840 ui_->SetIdentityInfo(info); |
829 } | 841 } |
OLD | NEW |