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

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

Issue 476513002: Add UMA histogram to count hard revokes of user certificate error decisions. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Got rid of extraneous #include Created 6 years, 4 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 | Annotate | Revision Log
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/website_settings/website_settings.h" 5 #include "chrome/browser/ui/website_settings/website_settings.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/bind.h" 10 #include "base/bind.h"
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 #include "chrome/browser/chromeos/policy/policy_cert_service_factory.h" 54 #include "chrome/browser/chromeos/policy/policy_cert_service_factory.h"
55 #endif 55 #endif
56 56
57 using base::ASCIIToUTF16; 57 using base::ASCIIToUTF16;
58 using base::UTF8ToUTF16; 58 using base::UTF8ToUTF16;
59 using base::UTF16ToUTF8; 59 using base::UTF16ToUTF8;
60 using content::BrowserThread; 60 using content::BrowserThread;
61 61
62 namespace { 62 namespace {
63 63
64 // Events for UMA. Do not reorder or change!
65 enum SSLCertificateDecisionsDidRevoke {
66 USER_CERT_DECISIONS_NOT_REVOKED = 0,
67 USER_CERT_DECISIONS_REVOKED,
68 END_OF_SSL_CERTIFICATE_DECISIONS_DID_REVOKE_ENUM
69 };
70
64 // The list of content settings types to display on the Website Settings UI. 71 // The list of content settings types to display on the Website Settings UI.
65 ContentSettingsType kPermissionType[] = { 72 ContentSettingsType kPermissionType[] = {
66 CONTENT_SETTINGS_TYPE_IMAGES, 73 CONTENT_SETTINGS_TYPE_IMAGES,
67 CONTENT_SETTINGS_TYPE_JAVASCRIPT, 74 CONTENT_SETTINGS_TYPE_JAVASCRIPT,
68 CONTENT_SETTINGS_TYPE_PLUGINS, 75 CONTENT_SETTINGS_TYPE_PLUGINS,
69 CONTENT_SETTINGS_TYPE_POPUPS, 76 CONTENT_SETTINGS_TYPE_POPUPS,
70 CONTENT_SETTINGS_TYPE_GEOLOCATION, 77 CONTENT_SETTINGS_TYPE_GEOLOCATION,
71 CONTENT_SETTINGS_TYPE_NOTIFICATIONS, 78 CONTENT_SETTINGS_TYPE_NOTIFICATIONS,
72 CONTENT_SETTINGS_TYPE_FULLSCREEN, 79 CONTENT_SETTINGS_TYPE_FULLSCREEN,
73 CONTENT_SETTINGS_TYPE_MOUSELOCK, 80 CONTENT_SETTINGS_TYPE_MOUSELOCK,
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 ui_(ui), 174 ui_(ui),
168 infobar_service_(infobar_service), 175 infobar_service_(infobar_service),
169 show_info_bar_(false), 176 show_info_bar_(false),
170 site_url_(url), 177 site_url_(url),
171 site_identity_status_(SITE_IDENTITY_STATUS_UNKNOWN), 178 site_identity_status_(SITE_IDENTITY_STATUS_UNKNOWN),
172 cert_id_(0), 179 cert_id_(0),
173 site_connection_status_(SITE_CONNECTION_STATUS_UNKNOWN), 180 site_connection_status_(SITE_CONNECTION_STATUS_UNKNOWN),
174 cert_store_(cert_store), 181 cert_store_(cert_store),
175 content_settings_(profile->GetHostContentSettingsMap()), 182 content_settings_(profile->GetHostContentSettingsMap()),
176 chrome_ssl_host_state_delegate_( 183 chrome_ssl_host_state_delegate_(
177 ChromeSSLHostStateDelegateFactory::GetForProfile(profile)) { 184 ChromeSSLHostStateDelegateFactory::GetForProfile(profile)),
185 did_revoke_user_ssl_decisions_(false) {
178 Init(profile, url, ssl); 186 Init(profile, url, ssl);
179 187
180 HistoryService* history_service = HistoryServiceFactory::GetForProfile( 188 HistoryService* history_service = HistoryServiceFactory::GetForProfile(
181 profile, Profile::EXPLICIT_ACCESS); 189 profile, Profile::EXPLICIT_ACCESS);
182 if (history_service) { 190 if (history_service) {
183 history_service->GetVisibleVisitCountToHost( 191 history_service->GetVisibleVisitCountToHost(
184 site_url_, 192 site_url_,
185 base::Bind(&WebsiteSettings::OnGotVisitCountToHost, 193 base::Bind(&WebsiteSettings::OnGotVisitCountToHost,
186 base::Unretained(this)), 194 base::Unretained(this)),
187 &visit_count_task_tracker_); 195 &visit_count_task_tracker_);
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
314 PresentHistoryInfo(first_visit); 322 PresentHistoryInfo(first_visit);
315 } 323 }
316 324
317 void WebsiteSettings::OnSiteDataAccessed() { 325 void WebsiteSettings::OnSiteDataAccessed() {
318 PresentSiteData(); 326 PresentSiteData();
319 } 327 }
320 328
321 void WebsiteSettings::OnUIClosing() { 329 void WebsiteSettings::OnUIClosing() {
322 if (show_info_bar_) 330 if (show_info_bar_)
323 WebsiteSettingsInfoBarDelegate::Create(infobar_service_); 331 WebsiteSettingsInfoBarDelegate::Create(infobar_service_);
332
333 if (did_revoke_user_ssl_decisions_) {
334 UMA_HISTOGRAM_ENUMERATION(
Alexei Svitkine (slow) 2014/08/21 19:36:11 Nit: Can you avoid having two separate macro block
jww 2014/08/21 20:26:36 Done.
335 "interstitial.ssl.did_user_revoke_decisions",
336 USER_CERT_DECISIONS_REVOKED,
337 END_OF_SSL_CERTIFICATE_DECISIONS_DID_REVOKE_ENUM);
338 } else {
339 UMA_HISTOGRAM_ENUMERATION(
340 "interstitial.ssl.did_user_revoke_decisions",
341 USER_CERT_DECISIONS_NOT_REVOKED,
342 END_OF_SSL_CERTIFICATE_DECISIONS_DID_REVOKE_ENUM);
343 }
344 }
345
346 void WebsiteSettings::OnSSLDecisionsRevokeButtonPressed() {
347 DCHECK(chrome_ssl_host_state_delegate_);
348 chrome_ssl_host_state_delegate_->RevokeUserDecisionsHard(site_url().host());
349 did_revoke_user_ssl_decisions_ = true;
324 } 350 }
325 351
326 void WebsiteSettings::Init(Profile* profile, 352 void WebsiteSettings::Init(Profile* profile,
327 const GURL& url, 353 const GURL& url,
328 const content::SSLStatus& ssl) { 354 const content::SSLStatus& ssl) {
329 if (url.SchemeIs(content::kChromeUIScheme)) { 355 if (url.SchemeIs(content::kChromeUIScheme)) {
330 site_identity_status_ = SITE_IDENTITY_STATUS_INTERNAL_PAGE; 356 site_identity_status_ = SITE_IDENTITY_STATUS_INTERNAL_PAGE;
331 site_identity_details_ = 357 site_identity_details_ =
332 l10n_util::GetStringUTF16(IDS_PAGE_INFO_INTERNAL_PAGE); 358 l10n_util::GetStringUTF16(IDS_PAGE_INFO_INTERNAL_PAGE);
333 site_connection_status_ = SITE_CONNECTION_STATUS_INTERNAL_PAGE; 359 site_connection_status_ = SITE_CONNECTION_STATUS_INTERNAL_PAGE;
(...skipping 394 matching lines...) Expand 10 before | Expand all | Expand 10 after
728 if (visited_before_today) { 754 if (visited_before_today) {
729 first_visit_text = l10n_util::GetStringFUTF16( 755 first_visit_text = l10n_util::GetStringFUTF16(
730 IDS_PAGE_INFO_SECURITY_TAB_VISITED_BEFORE_TODAY, 756 IDS_PAGE_INFO_SECURITY_TAB_VISITED_BEFORE_TODAY,
731 base::TimeFormatShortDate(first_visit)); 757 base::TimeFormatShortDate(first_visit));
732 } else { 758 } else {
733 first_visit_text = l10n_util::GetStringUTF16( 759 first_visit_text = l10n_util::GetStringUTF16(
734 IDS_PAGE_INFO_SECURITY_TAB_FIRST_VISITED_TODAY); 760 IDS_PAGE_INFO_SECURITY_TAB_FIRST_VISITED_TODAY);
735 } 761 }
736 ui_->SetFirstVisit(first_visit_text); 762 ui_->SetFirstVisit(first_visit_text);
737 } 763 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698