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

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

Issue 2966903002: Specialize Superfish interstitial metrics (Closed)
Patch Set: string -> const char[] Created 3 years, 5 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
« no previous file with comments | « no previous file | chrome/browser/ssl/ssl_browser_tests.cc » ('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 <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/bind_helpers.h" 10 #include "base/bind_helpers.h"
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 "interstitial.ssl.expiration_and_decision.nonoverridable", 92 "interstitial.ssl.expiration_and_decision.nonoverridable",
93 event, 93 event,
94 END_OF_SSL_EXPIRATION_AND_DECISION); 94 END_OF_SSL_EXPIRATION_AND_DECISION);
95 } 95 }
96 } 96 }
97 97
98 std::unique_ptr<ChromeMetricsHelper> CreateMetricsHelper( 98 std::unique_ptr<ChromeMetricsHelper> CreateMetricsHelper(
99 content::WebContents* web_contents, 99 content::WebContents* web_contents,
100 int cert_error, 100 int cert_error,
101 const GURL& request_url, 101 const GURL& request_url,
102 bool overridable) { 102 bool overridable,
103 bool is_superfish) {
103 security_interstitials::MetricsHelper::ReportDetails reporting_info; 104 security_interstitials::MetricsHelper::ReportDetails reporting_info;
104 reporting_info.metric_prefix = 105 if (is_superfish) {
105 overridable ? "ssl_overridable" : "ssl_nonoverridable"; 106 reporting_info.metric_prefix = "superfish";
107 } else {
108 reporting_info.metric_prefix =
109 overridable ? "ssl_overridable" : "ssl_nonoverridable";
110 }
106 return base::MakeUnique<ChromeMetricsHelper>( 111 return base::MakeUnique<ChromeMetricsHelper>(
107 web_contents, request_url, reporting_info, 112 web_contents, request_url, reporting_info,
108 GetSamplingEventName(overridable, cert_error)); 113 GetSamplingEventName(overridable, cert_error));
109 } 114 }
110 115
111 } // namespace 116 } // namespace
112 117
113 // static 118 // static
114 InterstitialPageDelegate::TypeID SSLBlockingPage::kTypeForTesting = 119 InterstitialPageDelegate::TypeID SSLBlockingPage::kTypeForTesting =
115 &SSLBlockingPage::kTypeForTesting; 120 &SSLBlockingPage::kTypeForTesting;
(...skipping 20 matching lines...) Expand all
136 const bool overridable = 141 const bool overridable =
137 is_superfish 142 is_superfish
138 ? false 143 ? false
139 : IsOverridable(options_mask, Profile::FromBrowserContext( 144 : IsOverridable(options_mask, Profile::FromBrowserContext(
140 web_contents->GetBrowserContext())); 145 web_contents->GetBrowserContext()));
141 if (overridable) 146 if (overridable)
142 options_mask |= SSLErrorUI::SOFT_OVERRIDE_ENABLED; 147 options_mask |= SSLErrorUI::SOFT_OVERRIDE_ENABLED;
143 else 148 else
144 options_mask &= ~SSLErrorUI::SOFT_OVERRIDE_ENABLED; 149 options_mask &= ~SSLErrorUI::SOFT_OVERRIDE_ENABLED;
145 150
146 std::unique_ptr<ChromeMetricsHelper> metrics_helper( 151 std::unique_ptr<ChromeMetricsHelper> metrics_helper(CreateMetricsHelper(
147 CreateMetricsHelper(web_contents, cert_error, request_url, overridable)); 152 web_contents, cert_error, request_url, overridable, is_superfish));
148 metrics_helper.get()->StartRecordingCaptivePortalMetrics(overridable); 153 metrics_helper.get()->StartRecordingCaptivePortalMetrics(overridable);
149 154
150 return new SSLBlockingPage(web_contents, cert_error, ssl_info, request_url, 155 return new SSLBlockingPage(web_contents, cert_error, ssl_info, request_url,
151 options_mask, time_triggered, 156 options_mask, time_triggered,
152 std::move(ssl_cert_reporter), overridable, 157 std::move(ssl_cert_reporter), overridable,
153 std::move(metrics_helper), is_superfish, callback); 158 std::move(metrics_helper), is_superfish, callback);
154 } 159 }
155 160
156 bool SSLBlockingPage::ShouldCreateNewNavigation() const { 161 bool SSLBlockingPage::ShouldCreateNewNavigation() const {
157 return true; 162 return true;
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
321 326
322 // static 327 // static
323 bool SSLBlockingPage::IsOverridable(int options_mask, 328 bool SSLBlockingPage::IsOverridable(int options_mask,
324 const Profile* const profile) { 329 const Profile* const profile) {
325 const bool is_overridable = 330 const bool is_overridable =
326 (options_mask & SSLErrorUI::SOFT_OVERRIDE_ENABLED) && 331 (options_mask & SSLErrorUI::SOFT_OVERRIDE_ENABLED) &&
327 !(options_mask & SSLErrorUI::STRICT_ENFORCEMENT) && 332 !(options_mask & SSLErrorUI::STRICT_ENFORCEMENT) &&
328 profile->GetPrefs()->GetBoolean(prefs::kSSLErrorOverrideAllowed); 333 profile->GetPrefs()->GetBoolean(prefs::kSSLErrorOverrideAllowed);
329 return is_overridable; 334 return is_overridable;
330 } 335 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ssl/ssl_browser_tests.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698