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

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

Issue 2949003003: Implement a skeleton of the Superfish interstitial (Closed)
Patch Set: Created 3 years, 6 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
OLDNEW
(Empty)
1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include "chrome/browser/ssl/superfish_blocking_page.h"
6
7 #include "chrome/browser/interstitials/chrome_metrics_helper.h"
8 #include "chrome/common/pref_names.h"
9 #include "components/prefs/pref_service.h"
10 #include "components/security_interstitials/content/security_interstitial_contro ller_client.h"
11 #include "components/security_interstitials/core/superfish_error_ui.h"
12 #include "content/public/browser/interstitial_page_delegate.h"
13 #include "content/public/browser/web_contents.h"
14
15 // static
16 content::InterstitialPageDelegate::TypeID
17 SuperfishBlockingPage::kTypeForTesting =
18 &SuperfishBlockingPage::kTypeForTesting;
19
20 // static
21 SuperfishBlockingPage* SuperfishBlockingPage::Create(
22 content::WebContents* web_contents,
23 int cert_error,
24 const net::SSLInfo& ssl_info,
25 const GURL& request_url,
26 int options_mask,
27 const base::Time& time_triggered,
28 std::unique_ptr<SSLCertReporter> ssl_cert_reporter,
29 const base::Callback<void(content::CertificateRequestResultType)>&
30 callback) {
31 Profile* profile =
32 Profile::FromBrowserContext(web_contents->GetBrowserContext());
33 if (profile &&
34 !profile->GetPrefs()->GetBoolean(prefs::kSSLErrorOverrideAllowed)) {
35 options_mask |= security_interstitials::SSLErrorUI::HARD_OVERRIDE_DISABLED;
36 }
37 // Superfish interstitials are not overridable.
38 options_mask &= ~security_interstitials::SSLErrorUI::SOFT_OVERRIDE_ENABLED;
meacer 2017/06/22 19:06:19 rant: These flags names are really confusing. HARD
estark 2017/06/22 22:01:05 Agreed. Great interstitial refactor will probably
39
40 std::unique_ptr<ChromeMetricsHelper> metrics_helper(CreateMetricsHelper(
41 web_contents, cert_error, request_url, false /* overridable */));
42 metrics_helper.get()->StartRecordingCaptivePortalMetrics(
43 false /* overridable */);
44
45 SuperfishBlockingPage* page = new SuperfishBlockingPage(
46 web_contents, ssl_info, request_url, options_mask, time_triggered,
47 std::move(ssl_cert_reporter), false /* overridable */,
48 std::move(metrics_helper), callback);
49 page->SetErrorUI(base::MakeUnique<security_interstitials::SuperfishErrorUI>(
50 request_url, cert_error, ssl_info, options_mask, time_triggered,
51 page->controller()));
52 return page;
53 }
54
55 content::InterstitialPageDelegate::TypeID
56 SuperfishBlockingPage::GetTypeForTesting() const {
57 return SuperfishBlockingPage::kTypeForTesting;
meacer 2017/06/22 19:06:19 It looks like the main reason we have a separate S
estark 2017/06/22 22:01:05 Good idea, thanks. Done.
58 }
59
60 SuperfishBlockingPage::SuperfishBlockingPage(
61 content::WebContents* web_contents,
62 const net::SSLInfo& ssl_info,
63 const GURL& request_url,
64 int options_mask,
65 const base::Time& time_triggered,
66 std::unique_ptr<SSLCertReporter> ssl_cert_reporter,
67 bool overridable,
68 std::unique_ptr<ChromeMetricsHelper> metrics_helper,
69 const base::Callback<void(content::CertificateRequestResultType)>& callback)
70 : SSLBlockingPage(web_contents,
71 ssl_info,
72 request_url,
73 options_mask,
74 time_triggered,
75 std::move(ssl_cert_reporter),
76 overridable,
77 std::move(metrics_helper),
78 callback) {
79 // Creating an interstitial without showing (e.g. from chrome://interstitials)
80 // it leaks memory, so don't create it here.
81 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698