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 250 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
261 content::WebContentsObserver(web_contents), | 261 content::WebContentsObserver(web_contents), |
262 ui_(ui), | 262 ui_(ui), |
263 show_info_bar_(false), | 263 show_info_bar_(false), |
264 site_url_(url), | 264 site_url_(url), |
265 site_identity_status_(SITE_IDENTITY_STATUS_UNKNOWN), | 265 site_identity_status_(SITE_IDENTITY_STATUS_UNKNOWN), |
266 site_connection_status_(SITE_CONNECTION_STATUS_UNKNOWN), | 266 site_connection_status_(SITE_CONNECTION_STATUS_UNKNOWN), |
267 content_settings_(HostContentSettingsMapFactory::GetForProfile(profile)), | 267 content_settings_(HostContentSettingsMapFactory::GetForProfile(profile)), |
268 chrome_ssl_host_state_delegate_( | 268 chrome_ssl_host_state_delegate_( |
269 ChromeSSLHostStateDelegateFactory::GetForProfile(profile)), | 269 ChromeSSLHostStateDelegateFactory::GetForProfile(profile)), |
270 did_revoke_user_ssl_decisions_(false), | 270 did_revoke_user_ssl_decisions_(false), |
271 profile_(profile) { | 271 profile_(profile), |
| 272 security_level_(security_state::SecurityStateModel::NONE) { |
272 Init(url, security_info); | 273 Init(url, security_info); |
273 | 274 |
274 PresentSitePermissions(); | 275 PresentSitePermissions(); |
275 PresentSiteData(); | 276 PresentSiteData(); |
276 PresentSiteIdentity(); | 277 PresentSiteIdentity(); |
277 | 278 |
278 // Every time the Website Settings UI is opened a |WebsiteSettings| object is | 279 // Every time the Website Settings UI is opened a |WebsiteSettings| object is |
279 // created. So this counts how ofter the Website Settings UI is opened. | 280 // created. So this counts how ofter the Website Settings UI is opened. |
280 RecordWebsiteSettingsAction(WEBSITE_SETTINGS_OPENED); | 281 RecordWebsiteSettingsAction(WEBSITE_SETTINGS_OPENED); |
281 } | 282 } |
282 | 283 |
283 WebsiteSettings::~WebsiteSettings() { | 284 WebsiteSettings::~WebsiteSettings() { |
284 } | 285 } |
285 | 286 |
286 void WebsiteSettings::RecordWebsiteSettingsAction( | 287 void WebsiteSettings::RecordWebsiteSettingsAction( |
287 WebsiteSettingsAction action) { | 288 WebsiteSettingsAction action) { |
288 UMA_HISTOGRAM_ENUMERATION("WebsiteSettings.Action", | 289 UMA_HISTOGRAM_ENUMERATION("WebsiteSettings.Action", |
289 action, | 290 action, |
290 WEBSITE_SETTINGS_COUNT); | 291 WEBSITE_SETTINGS_COUNT); |
291 | 292 |
292 // Use a separate histogram to record actions if they are done on a page with | 293 std::string histogram_name; |
293 // an HTTPS URL. Note that this *disregards* security status. | |
294 // | |
295 | 294 |
296 // TODO(palmer): Consider adding a new histogram for | 295 if (site_url_.SchemeIsCryptographic()) { |
297 // GURL::SchemeIsCryptographic. (We don't want to replace this call with a | 296 if (security_level_ == security_state::SecurityStateModel::SECURE || |
298 // call to that function because we don't want to change the meanings of | 297 security_level_ == security_state::SecurityStateModel::EV_SECURE) { |
299 // existing metrics.) This would inform the decision to mark non-secure | 298 UMA_HISTOGRAM_ENUMERATION("Security.PageInfo.Action.HttpsUrl.Valid", |
300 // origins as Dubious or Non-Secure; the overall bug for that is | 299 action, WEBSITE_SETTINGS_COUNT); |
301 // crbug.com/454579. | 300 } else if (security_level_ == security_state::SecurityStateModel::NONE) { |
302 if (site_url_.SchemeIs(url::kHttpsScheme)) { | 301 UMA_HISTOGRAM_ENUMERATION("Security.PageInfo.Action.HttpsUrl.Downgraded", |
303 UMA_HISTOGRAM_ENUMERATION("WebsiteSettings.Action.HttpsUrl", | 302 action, WEBSITE_SETTINGS_COUNT); |
304 action, | 303 } else if (security_level_ == |
305 WEBSITE_SETTINGS_COUNT); | 304 security_state::SecurityStateModel::DANGEROUS) { |
| 305 UMA_HISTOGRAM_ENUMERATION("Security.PageInfo.Action.HttpsUrl.Dangerous", |
| 306 action, WEBSITE_SETTINGS_COUNT); |
| 307 } |
| 308 return; |
| 309 } |
| 310 |
| 311 if (security_level_ == |
| 312 security_state::SecurityStateModel::HTTP_SHOW_WARNING) { |
| 313 UMA_HISTOGRAM_ENUMERATION("Security.PageInfo.Action.HttpUrl.Warning", |
| 314 action, WEBSITE_SETTINGS_COUNT); |
| 315 } else if (security_level_ == security_state::SecurityStateModel::DANGEROUS) { |
| 316 UMA_HISTOGRAM_ENUMERATION("Security.PageInfo.Action.HttpUrl.Dangerous", |
| 317 action, WEBSITE_SETTINGS_COUNT); |
| 318 } else { |
| 319 UMA_HISTOGRAM_ENUMERATION("Security.PageInfo.Action.HttpUrl.Neutral", |
| 320 action, WEBSITE_SETTINGS_COUNT); |
306 } | 321 } |
307 } | 322 } |
308 | 323 |
309 void WebsiteSettings::OnSitePermissionChanged(ContentSettingsType type, | 324 void WebsiteSettings::OnSitePermissionChanged(ContentSettingsType type, |
310 ContentSetting setting) { | 325 ContentSetting setting) { |
311 // Count how often a permission for a specific content type is changed using | 326 // Count how often a permission for a specific content type is changed using |
312 // the Website Settings UI. | 327 // the Website Settings UI. |
313 size_t num_values; | 328 size_t num_values; |
314 int histogram_value = ContentSettingTypeToHistogramValue(type, &num_values); | 329 int histogram_value = ContentSettingTypeToHistogramValue(type, &num_values); |
315 UMA_HISTOGRAM_ENUMERATION("WebsiteSettings.OriginInfo.PermissionChanged", | 330 UMA_HISTOGRAM_ENUMERATION("WebsiteSettings.OriginInfo.PermissionChanged", |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
405 !url.SchemeIs(content::kChromeDevToolsScheme) && | 420 !url.SchemeIs(content::kChromeDevToolsScheme) && |
406 !url.SchemeIs(content::kViewSourceScheme) && | 421 !url.SchemeIs(content::kViewSourceScheme) && |
407 !url.SchemeIs(content_settings::kExtensionScheme)); | 422 !url.SchemeIs(content_settings::kExtensionScheme)); |
408 #endif | 423 #endif |
409 | 424 |
410 bool isChromeUINativeScheme = false; | 425 bool isChromeUINativeScheme = false; |
411 #if BUILDFLAG(ANDROID_JAVA_UI) | 426 #if BUILDFLAG(ANDROID_JAVA_UI) |
412 isChromeUINativeScheme = url.SchemeIs(chrome::kChromeUINativeScheme); | 427 isChromeUINativeScheme = url.SchemeIs(chrome::kChromeUINativeScheme); |
413 #endif | 428 #endif |
414 | 429 |
| 430 security_level_ = security_info.security_level; |
| 431 |
415 if (url.SchemeIs(url::kAboutScheme)) { | 432 if (url.SchemeIs(url::kAboutScheme)) { |
416 // All about: URLs except about:blank are redirected. | 433 // All about: URLs except about:blank are redirected. |
417 DCHECK_EQ(url::kAboutBlankURL, url.spec()); | 434 DCHECK_EQ(url::kAboutBlankURL, url.spec()); |
418 site_identity_status_ = SITE_IDENTITY_STATUS_NO_CERT; | 435 site_identity_status_ = SITE_IDENTITY_STATUS_NO_CERT; |
419 site_identity_details_ = | 436 site_identity_details_ = |
420 l10n_util::GetStringUTF16(IDS_PAGE_INFO_SECURITY_TAB_INSECURE_IDENTITY); | 437 l10n_util::GetStringUTF16(IDS_PAGE_INFO_SECURITY_TAB_INSECURE_IDENTITY); |
421 site_connection_status_ = SITE_CONNECTION_STATUS_UNENCRYPTED; | 438 site_connection_status_ = SITE_CONNECTION_STATUS_UNENCRYPTED; |
422 site_connection_details_ = l10n_util::GetStringFUTF16( | 439 site_connection_details_ = l10n_util::GetStringFUTF16( |
423 IDS_PAGE_INFO_SECURITY_TAB_NOT_ENCRYPTED_CONNECTION_TEXT, | 440 IDS_PAGE_INFO_SECURITY_TAB_NOT_ENCRYPTED_CONNECTION_TEXT, |
424 UTF8ToUTF16(url.spec())); | 441 UTF8ToUTF16(url.spec())); |
(...skipping 395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
820 info.connection_status = site_connection_status_; | 837 info.connection_status = site_connection_status_; |
821 info.connection_status_description = | 838 info.connection_status_description = |
822 UTF16ToUTF8(site_connection_details_); | 839 UTF16ToUTF8(site_connection_details_); |
823 info.identity_status = site_identity_status_; | 840 info.identity_status = site_identity_status_; |
824 info.identity_status_description = | 841 info.identity_status_description = |
825 UTF16ToUTF8(site_identity_details_); | 842 UTF16ToUTF8(site_identity_details_); |
826 info.certificate = certificate_; | 843 info.certificate = certificate_; |
827 info.show_ssl_decision_revoke_button = show_ssl_decision_revoke_button_; | 844 info.show_ssl_decision_revoke_button = show_ssl_decision_revoke_button_; |
828 ui_->SetIdentityInfo(info); | 845 ui_->SetIdentityInfo(info); |
829 } | 846 } |
OLD | NEW |