OLD | NEW |
---|---|
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "ios/chrome/browser/ssl/ios_ssl_blocking_page.h" | 5 #include "ios/chrome/browser/ssl/ios_ssl_blocking_page.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
11 #include "base/strings/string_number_conversions.h" | 11 #include "base/strings/string_number_conversions.h" |
12 #include "base/strings/utf_string_conversions.h" | 12 #include "base/strings/utf_string_conversions.h" |
13 #include "components/security_interstitials/core/metrics_helper.h" | 13 #include "components/security_interstitials/core/metrics_helper.h" |
14 #include "components/security_interstitials/core/ssl_error_ui.h" | 14 #include "components/security_interstitials/core/ssl_error_ui.h" |
15 #include "grit/components_strings.h" | 15 #include "grit/components_strings.h" |
16 #include "ios/chrome/browser/browser_state/chrome_browser_state.h" | 16 #include "ios/chrome/browser/browser_state/chrome_browser_state.h" |
17 #include "ios/chrome/browser/interstitials/ios_chrome_controller_client.h" | 17 #include "ios/chrome/browser/interstitials/ios_chrome_controller_client.h" |
18 #include "ios/chrome/browser/interstitials/ios_chrome_metrics_helper.h" | 18 #include "ios/chrome/browser/interstitials/ios_chrome_metrics_helper.h" |
19 #include "ios/chrome/grit/ios_strings.h" | 19 #include "ios/chrome/grit/ios_strings.h" |
20 #include "ios/public/provider/chrome/browser/browser_constants.h" | 20 #include "ios/public/provider/chrome/browser/browser_constants.h" |
21 #include "ios/web/public/cert_store.h" | 21 #include "ios/web/public/cert_store.h" |
Eugene But (OOO till 7-30)
2016/09/08 16:57:46
ditto
| |
22 #import "ios/web/public/navigation_item.h" | 22 #import "ios/web/public/navigation_item.h" |
23 #include "ios/web/public/ssl_status.h" | 23 #include "ios/web/public/ssl_status.h" |
24 #include "ios/web/public/web_state/web_state.h" | 24 #include "ios/web/public/web_state/web_state.h" |
25 #include "net/base/net_errors.h" | 25 #include "net/base/net_errors.h" |
26 #include "ui/base/l10n/l10n_util.h" | 26 #include "ui/base/l10n/l10n_util.h" |
27 #include "url/gurl.h" | 27 #include "url/gurl.h" |
28 | 28 |
29 using security_interstitials::SSLErrorUI; | 29 using security_interstitials::SSLErrorUI; |
30 | 30 |
31 namespace { | 31 namespace { |
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
188 } | 188 } |
189 | 189 |
190 void IOSSSLBlockingPage::OverrideItem(web::NavigationItem* item) { | 190 void IOSSSLBlockingPage::OverrideItem(web::NavigationItem* item) { |
191 item->SetTitle(l10n_util::GetStringUTF16(IDS_SSL_V2_TITLE)); | 191 item->SetTitle(l10n_util::GetStringUTF16(IDS_SSL_V2_TITLE)); |
192 | 192 |
193 item->GetSSL().security_style = web::SECURITY_STYLE_AUTHENTICATION_BROKEN; | 193 item->GetSSL().security_style = web::SECURITY_STYLE_AUTHENTICATION_BROKEN; |
194 item->GetSSL().cert_status = ssl_info_.cert_status; | 194 item->GetSSL().cert_status = ssl_info_.cert_status; |
195 // On iOS cert may be null when it is not provided by API callback or can not | 195 // On iOS cert may be null when it is not provided by API callback or can not |
196 // be parsed. | 196 // be parsed. |
197 if (ssl_info_.cert) { | 197 if (ssl_info_.cert) { |
198 item->GetSSL().cert_id = web::CertStore::GetInstance()->StoreCert( | 198 item->GetSSL().certificate = ssl_info_.cert; |
199 ssl_info_.cert.get(), web_state()->GetCertGroupId()); | |
200 } | 199 } |
201 } | 200 } |
202 | 201 |
203 void IOSSSLBlockingPage::NotifyDenyCertificate() { | 202 void IOSSSLBlockingPage::NotifyDenyCertificate() { |
204 // It's possible that callback_ may not exist if the user clicks "Proceed" | 203 // It's possible that callback_ may not exist if the user clicks "Proceed" |
205 // followed by pressing the back button before the interstitial is hidden. | 204 // followed by pressing the back button before the interstitial is hidden. |
206 // In that case the certificate will still be treated as allowed. | 205 // In that case the certificate will still be treated as allowed. |
207 if (callback_.is_null()) | 206 if (callback_.is_null()) |
208 return; | 207 return; |
209 | 208 |
210 callback_.Run(false); | 209 callback_.Run(false); |
211 callback_.Reset(); | 210 callback_.Reset(); |
212 } | 211 } |
213 | 212 |
214 // static | 213 // static |
215 bool IOSSSLBlockingPage::IsOverridable(int options_mask) { | 214 bool IOSSSLBlockingPage::IsOverridable(int options_mask) { |
216 const bool is_overridable = | 215 const bool is_overridable = |
217 (options_mask & SSLErrorUI::SOFT_OVERRIDE_ENABLED) && | 216 (options_mask & SSLErrorUI::SOFT_OVERRIDE_ENABLED) && |
218 !(options_mask & SSLErrorUI::STRICT_ENFORCEMENT); | 217 !(options_mask & SSLErrorUI::STRICT_ENFORCEMENT); |
219 return is_overridable; | 218 return is_overridable; |
220 } | 219 } |
OLD | NEW |