OLD | NEW |
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/histogram.h" | 8 #include "base/metrics/histogram.h" |
9 #include "base/string_piece.h" | 9 #include "base/string_piece.h" |
10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 // The page is closed without the user having chosen what to do, default to | 76 // The page is closed without the user having chosen what to do, default to |
77 // deny. | 77 // deny. |
78 NotifyDenyCertificate(); | 78 NotifyDenyCertificate(); |
79 } | 79 } |
80 } | 80 } |
81 | 81 |
82 std::string SSLBlockingPage::GetHTMLContents() { | 82 std::string SSLBlockingPage::GetHTMLContents() { |
83 // Let's build the html error page. | 83 // Let's build the html error page. |
84 DictionaryValue strings; | 84 DictionaryValue strings; |
85 SSLErrorInfo error_info = SSLErrorInfo::CreateError( | 85 SSLErrorInfo error_info = SSLErrorInfo::CreateError( |
86 SSLErrorInfo::NetErrorToErrorType(cert_error_), ssl_info_.cert, | 86 SSLErrorInfo::NetErrorToErrorType(cert_error_), ssl_info_.cert.get(), |
87 request_url_); | 87 request_url_); |
88 | 88 |
89 strings.SetString("headLine", error_info.title()); | 89 strings.SetString("headLine", error_info.title()); |
90 strings.SetString("description", error_info.details()); | 90 strings.SetString("description", error_info.details()); |
91 | 91 |
92 strings.SetString("moreInfoTitle", | 92 strings.SetString("moreInfoTitle", |
93 l10n_util::GetStringUTF16(IDS_CERT_ERROR_EXTRA_INFO_TITLE)); | 93 l10n_util::GetStringUTF16(IDS_CERT_ERROR_EXTRA_INFO_TITLE)); |
94 SetExtraInfo(&strings, error_info.extra_information()); | 94 SetExtraInfo(&strings, error_info.extra_information()); |
95 | 95 |
96 int resource_id; | 96 int resource_id; |
(...skipping 25 matching lines...) Expand all Loading... |
122 | 122 |
123 base::StringPiece html( | 123 base::StringPiece html( |
124 ResourceBundle::GetSharedInstance().GetRawDataResource( | 124 ResourceBundle::GetSharedInstance().GetRawDataResource( |
125 resource_id, ui::SCALE_FACTOR_NONE)); | 125 resource_id, ui::SCALE_FACTOR_NONE)); |
126 | 126 |
127 return jstemplate_builder::GetI18nTemplateHtml(html, &strings); | 127 return jstemplate_builder::GetI18nTemplateHtml(html, &strings); |
128 } | 128 } |
129 | 129 |
130 void SSLBlockingPage::OverrideEntry(NavigationEntry* entry) { | 130 void SSLBlockingPage::OverrideEntry(NavigationEntry* entry) { |
131 int cert_id = content::CertStore::GetInstance()->StoreCert( | 131 int cert_id = content::CertStore::GetInstance()->StoreCert( |
132 ssl_info_.cert, web_contents_->GetRenderProcessHost()->GetID()); | 132 ssl_info_.cert.get(), web_contents_->GetRenderProcessHost()->GetID()); |
133 | 133 |
134 entry->GetSSL().security_style = | 134 entry->GetSSL().security_style = |
135 content::SECURITY_STYLE_AUTHENTICATION_BROKEN; | 135 content::SECURITY_STYLE_AUTHENTICATION_BROKEN; |
136 entry->GetSSL().cert_id = cert_id; | 136 entry->GetSSL().cert_id = cert_id; |
137 entry->GetSSL().cert_status = ssl_info_.cert_status; | 137 entry->GetSSL().cert_status = ssl_info_.cert_status; |
138 entry->GetSSL().security_bits = ssl_info_.security_bits; | 138 entry->GetSSL().security_bits = ssl_info_.security_bits; |
139 content::NotificationService::current()->Notify( | 139 content::NotificationService::current()->Notify( |
140 content::NOTIFICATION_SSL_VISIBLE_STATE_CHANGED, | 140 content::NOTIFICATION_SSL_VISIBLE_STATE_CHANGED, |
141 content::Source<NavigationController>(&web_contents_->GetController()), | 141 content::Source<NavigationController>(&web_contents_->GetController()), |
142 content::NotificationService::NoDetails()); | 142 content::NotificationService::NoDetails()); |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
197 "moreInfo1", "moreInfo2", "moreInfo3", "moreInfo4", "moreInfo5" | 197 "moreInfo1", "moreInfo2", "moreInfo3", "moreInfo4", "moreInfo5" |
198 }; | 198 }; |
199 int i; | 199 int i; |
200 for (i = 0; i < static_cast<int>(extra_info.size()); i++) { | 200 for (i = 0; i < static_cast<int>(extra_info.size()); i++) { |
201 strings->SetString(keys[i], extra_info[i]); | 201 strings->SetString(keys[i], extra_info[i]); |
202 } | 202 } |
203 for (; i < 5; i++) { | 203 for (; i < 5; i++) { |
204 strings->SetString(keys[i], ""); | 204 strings->SetString(keys[i], ""); |
205 } | 205 } |
206 } | 206 } |
OLD | NEW |