OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/captive_portal_blocking_page.h" | 5 #include "chrome/browser/ssl/captive_portal_blocking_page.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/i18n/rtl.h" | 9 #include "base/i18n/rtl.h" |
10 #include "base/metrics/histogram_macros.h" | 10 #include "base/metrics/histogram_macros.h" |
11 #include "base/strings/string_number_conversions.h" | 11 #include "base/strings/string_number_conversions.h" |
12 #include "base/strings/string_util.h" | 12 #include "base/strings/string_util.h" |
13 #include "base/strings/utf_string_conversions.h" | 13 #include "base/strings/utf_string_conversions.h" |
14 #include "base/values.h" | 14 #include "base/values.h" |
15 #include "build/build_config.h" | 15 #include "build/build_config.h" |
16 #include "chrome/browser/captive_portal/captive_portal_tab_helper.h" | 16 #include "chrome/browser/captive_portal/captive_portal_tab_helper.h" |
17 #include "chrome/browser/ssl/cert_report_helper.h" | 17 #include "chrome/browser/ssl/cert_report_helper.h" |
18 #include "chrome/browser/ssl/ssl_cert_reporter.h" | 18 #include "chrome/browser/ssl/ssl_cert_reporter.h" |
19 #include "chrome/grit/generated_resources.h" | 19 #include "chrome/grit/generated_resources.h" |
20 #include "components/captive_portal/captive_portal_detector.h" | 20 #include "components/captive_portal/captive_portal_detector.h" |
21 #include "components/certificate_reporting/error_reporter.h" | 21 #include "components/certificate_reporting/error_reporter.h" |
22 #include "components/security_interstitials/core/common_string_util.h" | 22 #include "components/security_interstitials/core/common_string_util.h" |
23 #include "components/security_interstitials/core/controller_client.h" | 23 #include "components/security_interstitials/core/controller_client.h" |
| 24 #include "components/security_interstitials/core/metrics_helper.h" |
24 #include "components/url_formatter/url_formatter.h" | 25 #include "components/url_formatter/url_formatter.h" |
25 #include "components/wifi/wifi_service.h" | 26 #include "components/wifi/wifi_service.h" |
26 #include "content/public/browser/web_contents.h" | 27 #include "content/public/browser/web_contents.h" |
27 #include "net/base/network_change_notifier.h" | 28 #include "net/base/network_change_notifier.h" |
28 #include "net/base/network_interfaces.h" | 29 #include "net/base/network_interfaces.h" |
29 #include "net/ssl/ssl_info.h" | 30 #include "net/ssl/ssl_info.h" |
30 #include "ui/base/l10n/l10n_util.h" | 31 #include "ui/base/l10n/l10n_util.h" |
31 | 32 |
32 namespace { | 33 namespace { |
33 | 34 |
(...skipping 15 matching lines...) Expand all Loading... |
49 const void* const CaptivePortalBlockingPage::kTypeForTesting = | 50 const void* const CaptivePortalBlockingPage::kTypeForTesting = |
50 &CaptivePortalBlockingPage::kTypeForTesting; | 51 &CaptivePortalBlockingPage::kTypeForTesting; |
51 | 52 |
52 CaptivePortalBlockingPage::CaptivePortalBlockingPage( | 53 CaptivePortalBlockingPage::CaptivePortalBlockingPage( |
53 content::WebContents* web_contents, | 54 content::WebContents* web_contents, |
54 const GURL& request_url, | 55 const GURL& request_url, |
55 const GURL& login_url, | 56 const GURL& login_url, |
56 std::unique_ptr<SSLCertReporter> ssl_cert_reporter, | 57 std::unique_ptr<SSLCertReporter> ssl_cert_reporter, |
57 const net::SSLInfo& ssl_info, | 58 const net::SSLInfo& ssl_info, |
58 const base::Callback<void(content::CertificateRequestResultType)>& callback) | 59 const base::Callback<void(content::CertificateRequestResultType)>& callback) |
59 : SecurityInterstitialPage(web_contents, request_url), | 60 : SecurityInterstitialPage(web_contents, request_url, nullptr), |
60 login_url_(login_url), | 61 login_url_(login_url), |
61 callback_(callback) { | 62 callback_(callback) { |
62 DCHECK(login_url_.is_valid()); | 63 DCHECK(login_url_.is_valid()); |
63 | 64 |
64 if (ssl_cert_reporter) { | 65 if (ssl_cert_reporter) { |
65 cert_report_helper_.reset(new CertReportHelper( | 66 cert_report_helper_.reset(new CertReportHelper( |
66 std::move(ssl_cert_reporter), web_contents, request_url, ssl_info, | 67 std::move(ssl_cert_reporter), web_contents, request_url, ssl_info, |
67 certificate_reporting::ErrorReport::INTERSTITIAL_CAPTIVE_PORTAL, false, | 68 certificate_reporting::ErrorReport::INTERSTITIAL_CAPTIVE_PORTAL, false, |
68 nullptr)); | 69 nullptr)); |
69 } | 70 } |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
217 certificate_reporting::ErrorReport::USER_DID_NOT_PROCEED); | 218 certificate_reporting::ErrorReport::USER_DID_NOT_PROCEED); |
218 } | 219 } |
219 | 220 |
220 // Need to explicity deny the certificate via the callback, otherwise memory | 221 // Need to explicity deny the certificate via the callback, otherwise memory |
221 // is leaked. | 222 // is leaked. |
222 if (!callback_.is_null()) { | 223 if (!callback_.is_null()) { |
223 callback_.Run(content::CERTIFICATE_REQUEST_RESULT_TYPE_CANCEL); | 224 callback_.Run(content::CERTIFICATE_REQUEST_RESULT_TYPE_CANCEL); |
224 callback_.Reset(); | 225 callback_.Reset(); |
225 } | 226 } |
226 } | 227 } |
OLD | NEW |