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 security_level_ == security_state::SecurityStateModel::EV_SECURE) { |
299 // existing metrics.) This would inform the decision to mark non-secure | 297 UMA_HISTOGRAM_ENUMERATION("Security.PageInfo.Action.HttpsUrl.Valid", |
300 // origins as Dubious or Non-Secure; the overall bug for that is | 298 action, WEBSITE_SETTINGS_COUNT); |
301 // crbug.com/454579. | 299 } else if (security_level_ == security_state::SecurityStateModel::NONE) { |
302 if (site_url_.SchemeIs(url::kHttpsScheme)) { | 300 UMA_HISTOGRAM_ENUMERATION("Security.PageInfo.Action.HttpsUrl.Downgraded", |
303 UMA_HISTOGRAM_ENUMERATION("WebsiteSettings.Action.HttpsUrl", | 301 action, WEBSITE_SETTINGS_COUNT); |
304 action, | 302 } else if (security_level_ == |
305 WEBSITE_SETTINGS_COUNT); | 303 security_state::SecurityStateModel::DANGEROUS) { |
| 304 UMA_HISTOGRAM_ENUMERATION("Security.PageInfo.Action.HttpsUrl.Dangerous", |
| 305 action, WEBSITE_SETTINGS_COUNT); |
| 306 } |
| 307 return; |
| 308 } |
| 309 |
| 310 if (security_level_ == |
| 311 security_state::SecurityStateModel::HTTP_SHOW_WARNING) { |
| 312 UMA_HISTOGRAM_ENUMERATION("Security.PageInfo.Action.HttpUrl.Warning", |
| 313 action, WEBSITE_SETTINGS_COUNT); |
| 314 } else if (security_level_ == security_state::SecurityStateModel::DANGEROUS) { |
| 315 UMA_HISTOGRAM_ENUMERATION("Security.PageInfo.Action.HttpUrl.Dangerous", |
| 316 action, WEBSITE_SETTINGS_COUNT); |
| 317 } else { |
| 318 UMA_HISTOGRAM_ENUMERATION("Security.PageInfo.Action.HttpUrl.Neutral", |
| 319 action, WEBSITE_SETTINGS_COUNT); |
306 } | 320 } |
307 } | 321 } |
308 | 322 |
309 void WebsiteSettings::OnSitePermissionChanged(ContentSettingsType type, | 323 void WebsiteSettings::OnSitePermissionChanged(ContentSettingsType type, |
310 ContentSetting setting) { | 324 ContentSetting setting) { |
311 // Count how often a permission for a specific content type is changed using | 325 // Count how often a permission for a specific content type is changed using |
312 // the Website Settings UI. | 326 // the Website Settings UI. |
313 size_t num_values; | 327 size_t num_values; |
314 int histogram_value = ContentSettingTypeToHistogramValue(type, &num_values); | 328 int histogram_value = ContentSettingTypeToHistogramValue(type, &num_values); |
315 UMA_HISTOGRAM_ENUMERATION("WebsiteSettings.OriginInfo.PermissionChanged", | 329 UMA_HISTOGRAM_ENUMERATION("WebsiteSettings.OriginInfo.PermissionChanged", |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
405 !url.SchemeIs(content::kChromeDevToolsScheme) && | 419 !url.SchemeIs(content::kChromeDevToolsScheme) && |
406 !url.SchemeIs(content::kViewSourceScheme) && | 420 !url.SchemeIs(content::kViewSourceScheme) && |
407 !url.SchemeIs(content_settings::kExtensionScheme)); | 421 !url.SchemeIs(content_settings::kExtensionScheme)); |
408 #endif | 422 #endif |
409 | 423 |
410 bool isChromeUINativeScheme = false; | 424 bool isChromeUINativeScheme = false; |
411 #if BUILDFLAG(ANDROID_JAVA_UI) | 425 #if BUILDFLAG(ANDROID_JAVA_UI) |
412 isChromeUINativeScheme = url.SchemeIs(chrome::kChromeUINativeScheme); | 426 isChromeUINativeScheme = url.SchemeIs(chrome::kChromeUINativeScheme); |
413 #endif | 427 #endif |
414 | 428 |
| 429 security_level_ = security_info.security_level; |
| 430 |
415 if (url.SchemeIs(url::kAboutScheme)) { | 431 if (url.SchemeIs(url::kAboutScheme)) { |
416 // All about: URLs except about:blank are redirected. | 432 // All about: URLs except about:blank are redirected. |
417 DCHECK_EQ(url::kAboutBlankURL, url.spec()); | 433 DCHECK_EQ(url::kAboutBlankURL, url.spec()); |
418 site_identity_status_ = SITE_IDENTITY_STATUS_NO_CERT; | 434 site_identity_status_ = SITE_IDENTITY_STATUS_NO_CERT; |
419 site_identity_details_ = | 435 site_identity_details_ = |
420 l10n_util::GetStringUTF16(IDS_PAGE_INFO_SECURITY_TAB_INSECURE_IDENTITY); | 436 l10n_util::GetStringUTF16(IDS_PAGE_INFO_SECURITY_TAB_INSECURE_IDENTITY); |
421 site_connection_status_ = SITE_CONNECTION_STATUS_UNENCRYPTED; | 437 site_connection_status_ = SITE_CONNECTION_STATUS_UNENCRYPTED; |
422 site_connection_details_ = l10n_util::GetStringFUTF16( | 438 site_connection_details_ = l10n_util::GetStringFUTF16( |
423 IDS_PAGE_INFO_SECURITY_TAB_NOT_ENCRYPTED_CONNECTION_TEXT, | 439 IDS_PAGE_INFO_SECURITY_TAB_NOT_ENCRYPTED_CONNECTION_TEXT, |
424 UTF8ToUTF16(url.spec())); | 440 UTF8ToUTF16(url.spec())); |
(...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
820 info.connection_status = site_connection_status_; | 836 info.connection_status = site_connection_status_; |
821 info.connection_status_description = | 837 info.connection_status_description = |
822 UTF16ToUTF8(site_connection_details_); | 838 UTF16ToUTF8(site_connection_details_); |
823 info.identity_status = site_identity_status_; | 839 info.identity_status = site_identity_status_; |
824 info.identity_status_description = | 840 info.identity_status_description = |
825 UTF16ToUTF8(site_identity_details_); | 841 UTF16ToUTF8(site_identity_details_); |
826 info.certificate = certificate_; | 842 info.certificate = certificate_; |
827 info.show_ssl_decision_revoke_button = show_ssl_decision_revoke_button_; | 843 info.show_ssl_decision_revoke_button = show_ssl_decision_revoke_button_; |
828 ui_->SetIdentityInfo(info); | 844 ui_->SetIdentityInfo(info); |
829 } | 845 } |
OLD | NEW |