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

Side by Side Diff: chrome/browser/ssl/ssl_blocking_page.cc

Issue 21572002: Add UMA entry for intranet SSL warnings (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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
« no previous file with comments | « chrome/browser/ssl/ssl_blocking_page.h ('k') | net/cert/cert_verify_proc.h » ('j') | 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/ssl/ssl_blocking_page.h" 5 #include "chrome/browser/ssl/ssl_blocking_page.h"
6 6
7 #include "base/i18n/rtl.h" 7 #include "base/i18n/rtl.h"
8 #include "base/metrics/field_trial.h" 8 #include "base/metrics/field_trial.h"
9 #include "base/metrics/histogram.h" 9 #include "base/metrics/histogram.h"
10 #include "base/strings/string_piece.h" 10 #include "base/strings/string_piece.h"
(...skipping 11 matching lines...) Expand all
22 #include "content/public/browser/notification_service.h" 22 #include "content/public/browser/notification_service.h"
23 #include "content/public/browser/notification_types.h" 23 #include "content/public/browser/notification_types.h"
24 #include "content/public/browser/render_process_host.h" 24 #include "content/public/browser/render_process_host.h"
25 #include "content/public/browser/render_view_host.h" 25 #include "content/public/browser/render_view_host.h"
26 #include "content/public/browser/web_contents.h" 26 #include "content/public/browser/web_contents.h"
27 #include "content/public/common/ssl_status.h" 27 #include "content/public/common/ssl_status.h"
28 #include "grit/app_locale_settings.h" 28 #include "grit/app_locale_settings.h"
29 #include "grit/browser_resources.h" 29 #include "grit/browser_resources.h"
30 #include "grit/generated_resources.h" 30 #include "grit/generated_resources.h"
31 #include "net/base/net_errors.h" 31 #include "net/base/net_errors.h"
32 #include "net/cert/cert_verify_proc.h"
32 #include "ui/base/l10n/l10n_util.h" 33 #include "ui/base/l10n/l10n_util.h"
33 #include "ui/base/resource/resource_bundle.h" 34 #include "ui/base/resource/resource_bundle.h"
34 #include "ui/webui/jstemplate_builder.h" 35 #include "ui/webui/jstemplate_builder.h"
35 36
36 #if defined(OS_WIN) 37 #if defined(OS_WIN)
37 #include "base/win/windows_version.h" 38 #include "base/win/windows_version.h"
38 #endif 39 #endif
39 40
40 using base::TimeDelta; 41 using base::TimeDelta;
41 using base::TimeTicks; 42 using base::TimeTicks;
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 PROCEED_OVERRIDABLE, 76 PROCEED_OVERRIDABLE,
76 PROCEED_NAME, 77 PROCEED_NAME,
77 PROCEED_DATE, 78 PROCEED_DATE,
78 PROCEED_AUTHORITY, 79 PROCEED_AUTHORITY,
79 DONT_PROCEED_OVERRIDABLE, 80 DONT_PROCEED_OVERRIDABLE,
80 DONT_PROCEED_NAME, 81 DONT_PROCEED_NAME,
81 DONT_PROCEED_DATE, 82 DONT_PROCEED_DATE,
82 DONT_PROCEED_AUTHORITY, 83 DONT_PROCEED_AUTHORITY,
83 MORE, 84 MORE,
84 SHOW_UNDERSTAND, 85 SHOW_UNDERSTAND,
86 SHOW_INTERNAL_HOSTNAME,
87 PROCEED_INTERNAL_HOSTNAME,
85 UNUSED_BLOCKING_PAGE_EVENT, 88 UNUSED_BLOCKING_PAGE_EVENT,
86 }; 89 };
87 90
88 void RecordSSLBlockingPageEventStats(SSLBlockingPageEvent event) { 91 void RecordSSLBlockingPageEventStats(SSLBlockingPageEvent event) {
89 UMA_HISTOGRAM_ENUMERATION("interstitial.ssl", 92 UMA_HISTOGRAM_ENUMERATION("interstitial.ssl",
90 event, 93 event,
91 UNUSED_BLOCKING_PAGE_EVENT); 94 UNUSED_BLOCKING_PAGE_EVENT);
92 } 95 }
93 96
94 void RecordSSLBlockingPageTimeStats( 97 void RecordSSLBlockingPageTimeStats(
95 bool proceed, 98 bool proceed,
96 int cert_error, 99 int cert_error,
97 bool overridable, 100 bool overridable,
101 bool internal,
98 const base::TimeTicks& start_time, 102 const base::TimeTicks& start_time,
99 const base::TimeTicks& end_time) { 103 const base::TimeTicks& end_time) {
100 UMA_HISTOGRAM_ENUMERATION("interstitial.ssl_error_type", 104 UMA_HISTOGRAM_ENUMERATION("interstitial.ssl_error_type",
101 SSLErrorInfo::NetErrorToErrorType(cert_error), SSLErrorInfo::END_OF_ENUM); 105 SSLErrorInfo::NetErrorToErrorType(cert_error), SSLErrorInfo::END_OF_ENUM);
102 if (start_time.is_null() || !overridable) { 106 if (start_time.is_null() || !overridable) {
103 // A null start time will occur if the page never came into focus and the 107 // A null start time will occur if the page never came into focus and the
104 // user quit without seeing it. If so, we don't record the time. 108 // user quit without seeing it. If so, we don't record the time.
105 // The user might not have an option except to turn back; that happens 109 // The user might not have an option except to turn back; that happens
106 // if overridable is true. If so, the time/outcome isn't meaningful. 110 // if overridable is true. If so, the time/outcome isn't meaningful.
107 return; 111 return;
108 } 112 }
109 base::TimeDelta delta = end_time - start_time; 113 base::TimeDelta delta = end_time - start_time;
110 if (proceed) { 114 if (proceed) {
111 RecordSSLBlockingPageEventStats(PROCEED_OVERRIDABLE); 115 RecordSSLBlockingPageEventStats(PROCEED_OVERRIDABLE);
112 HISTOGRAM_INTERSTITIAL_LARGE_TIME("interstitial.ssl_accept_time", delta); 116 HISTOGRAM_INTERSTITIAL_LARGE_TIME("interstitial.ssl_accept_time", delta);
117 if (internal) RecordSSLBlockingPageEventStats(PROCEED_INTERNAL_HOSTNAME);
Ryan Sleevi 2013/08/01 17:36:15 Not recording reject for internals? On a style ni
felt 2013/08/01 19:00:28 We don't need to; SHOW - PROCEED = REJECT. We can
113 } else if (!proceed) { 118 } else if (!proceed) {
114 RecordSSLBlockingPageEventStats(DONT_PROCEED_OVERRIDABLE); 119 RecordSSLBlockingPageEventStats(DONT_PROCEED_OVERRIDABLE);
115 HISTOGRAM_INTERSTITIAL_LARGE_TIME("interstitial.ssl_reject_time", delta); 120 HISTOGRAM_INTERSTITIAL_LARGE_TIME("interstitial.ssl_reject_time", delta);
116 } 121 }
117 SSLErrorInfo::ErrorType type = SSLErrorInfo::NetErrorToErrorType(cert_error); 122 SSLErrorInfo::ErrorType type = SSLErrorInfo::NetErrorToErrorType(cert_error);
118 switch (type) { 123 switch (type) {
119 case SSLErrorInfo::CERT_COMMON_NAME_INVALID: { 124 case SSLErrorInfo::CERT_COMMON_NAME_INVALID: {
120 HISTOGRAM_INTERSTITIAL_SMALL_TIME( 125 HISTOGRAM_INTERSTITIAL_SMALL_TIME(
121 "interstitial.common_name_invalid_time", 126 "interstitial.common_name_invalid_time",
122 delta); 127 delta);
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 const GURL& request_url, 178 const GURL& request_url,
174 bool overridable, 179 bool overridable,
175 bool strict_enforcement, 180 bool strict_enforcement,
176 const base::Callback<void(bool)>& callback) 181 const base::Callback<void(bool)>& callback)
177 : callback_(callback), 182 : callback_(callback),
178 web_contents_(web_contents), 183 web_contents_(web_contents),
179 cert_error_(cert_error), 184 cert_error_(cert_error),
180 ssl_info_(ssl_info), 185 ssl_info_(ssl_info),
181 request_url_(request_url), 186 request_url_(request_url),
182 overridable_(overridable), 187 overridable_(overridable),
183 strict_enforcement_(strict_enforcement) { 188 strict_enforcement_(strict_enforcement),
189 internal_(false) {
184 trialCondition_ = base::FieldTrialList::FindFullName(kStudyName); 190 trialCondition_ = base::FieldTrialList::FindFullName(kStudyName);
185 191
192 if (net::CertVerifyProc::IsHostnameNonUnique(request_url_.HostNoBrackets()))
193 internal_ = true;
194
186 RecordSSLBlockingPageEventStats(SHOW_ALL); 195 RecordSSLBlockingPageEventStats(SHOW_ALL);
187 if (overridable_ && !strict_enforcement_) 196 if (overridable_ && !strict_enforcement_) {
188 RecordSSLBlockingPageEventStats(SHOW_OVERRIDABLE); 197 RecordSSLBlockingPageEventStats(SHOW_OVERRIDABLE);
198 if (internal_) RecordSSLBlockingPageEventStats(SHOW_INTERNAL_HOSTNAME);
199 }
189 200
190 interstitial_page_ = InterstitialPage::Create( 201 interstitial_page_ = InterstitialPage::Create(
191 web_contents_, true, request_url, this); 202 web_contents_, true, request_url, this);
192 display_start_time_ = TimeTicks(); 203 display_start_time_ = TimeTicks();
193 interstitial_page_->Show(); 204 interstitial_page_->Show();
194 } 205 }
195 206
196 SSLBlockingPage::~SSLBlockingPage() { 207 SSLBlockingPage::~SSLBlockingPage() {
197 if (!callback_.is_null()) { 208 if (!callback_.is_null()) {
198 RecordSSLBlockingPageTimeStats( 209 RecordSSLBlockingPageTimeStats(
199 false, cert_error_, 210 false, cert_error_,
200 overridable_ && !strict_enforcement_, display_start_time_, 211 overridable_ && !strict_enforcement_, internal_, display_start_time_,
201 base::TimeTicks::Now()); 212 base::TimeTicks::Now());
Ryan Sleevi 2013/08/01 17:36:15 style: Can you clang-format / style guide format t
felt 2013/08/01 19:00:28 Done, substantially less ugly now.
202 // The page is closed without the user having chosen what to do, default to 213 // The page is closed without the user having chosen what to do, default to
203 // deny. 214 // deny.
204 NotifyDenyCertificate(); 215 NotifyDenyCertificate();
205 } 216 }
206 } 217 }
207 218
208 std::string SSLBlockingPage::GetHTMLContents() { 219 std::string SSLBlockingPage::GetHTMLContents() {
209 // Let's build the html error page. 220 // Let's build the html error page.
210 DictionaryValue strings; 221 DictionaryValue strings;
211 SSLErrorInfo error_info = 222 SSLErrorInfo error_info =
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
315 326
316 void SSLBlockingPage::OverrideRendererPrefs( 327 void SSLBlockingPage::OverrideRendererPrefs(
317 content::RendererPreferences* prefs) { 328 content::RendererPreferences* prefs) {
318 Profile* profile = Profile::FromBrowserContext( 329 Profile* profile = Profile::FromBrowserContext(
319 web_contents_->GetBrowserContext()); 330 web_contents_->GetBrowserContext());
320 renderer_preferences_util::UpdateFromSystemSettings(prefs, profile); 331 renderer_preferences_util::UpdateFromSystemSettings(prefs, profile);
321 } 332 }
322 333
323 void SSLBlockingPage::OnProceed() { 334 void SSLBlockingPage::OnProceed() {
324 RecordSSLBlockingPageTimeStats(true, cert_error_, 335 RecordSSLBlockingPageTimeStats(true, cert_error_,
325 overridable_ && !strict_enforcement_, display_start_time_, 336 overridable_ && !strict_enforcement_, internal_, display_start_time_,
326 base::TimeTicks::Now()); 337 base::TimeTicks::Now());
327 338
328 // Accepting the certificate resumes the loading of the page. 339 // Accepting the certificate resumes the loading of the page.
329 NotifyAllowCertificate(); 340 NotifyAllowCertificate();
330 } 341 }
331 342
332 void SSLBlockingPage::OnDontProceed() { 343 void SSLBlockingPage::OnDontProceed() {
333 RecordSSLBlockingPageTimeStats(false, cert_error_, 344 RecordSSLBlockingPageTimeStats(false, cert_error_,
334 overridable_ && !strict_enforcement_, display_start_time_, 345 overridable_ && !strict_enforcement_, internal_, display_start_time_,
335 base::TimeTicks::Now()); 346 base::TimeTicks::Now());
336 347
337 NotifyDenyCertificate(); 348 NotifyDenyCertificate();
338 } 349 }
339 350
340 void SSLBlockingPage::NotifyDenyCertificate() { 351 void SSLBlockingPage::NotifyDenyCertificate() {
341 // It's possible that callback_ may not exist if the user clicks "Proceed" 352 // It's possible that callback_ may not exist if the user clicks "Proceed"
342 // followed by pressing the back button before the interstitial is hidden. 353 // followed by pressing the back button before the interstitial is hidden.
343 // In that case the certificate will still be treated as allowed. 354 // In that case the certificate will still be treated as allowed.
344 if (callback_.is_null()) 355 if (callback_.is_null())
(...skipping 19 matching lines...) Expand all
364 "moreInfo1", "moreInfo2", "moreInfo3", "moreInfo4", "moreInfo5" 375 "moreInfo1", "moreInfo2", "moreInfo3", "moreInfo4", "moreInfo5"
365 }; 376 };
366 int i; 377 int i;
367 for (i = 0; i < static_cast<int>(extra_info.size()); i++) { 378 for (i = 0; i < static_cast<int>(extra_info.size()); i++) {
368 strings->SetString(keys[i], extra_info[i]); 379 strings->SetString(keys[i], extra_info[i]);
369 } 380 }
370 for (; i < 5; i++) { 381 for (; i < 5; i++) {
371 strings->SetString(keys[i], std::string()); 382 strings->SetString(keys[i], std::string());
372 } 383 }
373 } 384 }
OLDNEW
« no previous file with comments | « chrome/browser/ssl/ssl_blocking_page.h ('k') | net/cert/cert_verify_proc.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698