| 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/field_trial.h" | 8 #include "base/metrics/field_trial.h" |
| 9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
| 10 #include "base/strings/string_piece.h" | 10 #include "base/strings/string_piece.h" |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 base::TimeTicks::Now()); | 198 base::TimeTicks::Now()); |
| 199 // The page is closed without the user having chosen what to do, default to | 199 // The page is closed without the user having chosen what to do, default to |
| 200 // deny. | 200 // deny. |
| 201 NotifyDenyCertificate(); | 201 NotifyDenyCertificate(); |
| 202 } | 202 } |
| 203 } | 203 } |
| 204 | 204 |
| 205 std::string SSLBlockingPage::GetHTMLContents() { | 205 std::string SSLBlockingPage::GetHTMLContents() { |
| 206 // Let's build the html error page. | 206 // Let's build the html error page. |
| 207 DictionaryValue strings; | 207 DictionaryValue strings; |
| 208 SSLErrorInfo error_info = SSLErrorInfo::CreateError( | 208 SSLErrorInfo error_info = |
| 209 SSLErrorInfo::NetErrorToErrorType(cert_error_), ssl_info_.cert, | 209 SSLErrorInfo::CreateError(SSLErrorInfo::NetErrorToErrorType(cert_error_), |
| 210 request_url_); | 210 ssl_info_.cert.get(), |
| 211 request_url_); |
| 211 | 212 |
| 212 int resource_id = IDR_SSL_ROAD_BLOCK_HTML; | 213 int resource_id = IDR_SSL_ROAD_BLOCK_HTML; |
| 213 strings.SetString("headLine", error_info.title()); | 214 strings.SetString("headLine", error_info.title()); |
| 214 strings.SetString("description", error_info.details()); | 215 strings.SetString("description", error_info.details()); |
| 215 strings.SetString("moreInfoTitle", | 216 strings.SetString("moreInfoTitle", |
| 216 l10n_util::GetStringUTF16(IDS_CERT_ERROR_EXTRA_INFO_TITLE)); | 217 l10n_util::GetStringUTF16(IDS_CERT_ERROR_EXTRA_INFO_TITLE)); |
| 217 SetExtraInfo(&strings, error_info.extra_information()); | 218 SetExtraInfo(&strings, error_info.extra_information()); |
| 218 | 219 |
| 219 strings.SetString("exit", | 220 strings.SetString("exit", |
| 220 l10n_util::GetStringUTF16(IDS_SSL_BLOCKING_PAGE_EXIT)); | 221 l10n_util::GetStringUTF16(IDS_SSL_BLOCKING_PAGE_EXIT)); |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 270 | 271 |
| 271 base::StringPiece html( | 272 base::StringPiece html( |
| 272 ResourceBundle::GetSharedInstance().GetRawDataResource( | 273 ResourceBundle::GetSharedInstance().GetRawDataResource( |
| 273 resource_id)); | 274 resource_id)); |
| 274 | 275 |
| 275 return webui::GetI18nTemplateHtml(html, &strings); | 276 return webui::GetI18nTemplateHtml(html, &strings); |
| 276 } | 277 } |
| 277 | 278 |
| 278 void SSLBlockingPage::OverrideEntry(NavigationEntry* entry) { | 279 void SSLBlockingPage::OverrideEntry(NavigationEntry* entry) { |
| 279 int cert_id = content::CertStore::GetInstance()->StoreCert( | 280 int cert_id = content::CertStore::GetInstance()->StoreCert( |
| 280 ssl_info_.cert, web_contents_->GetRenderProcessHost()->GetID()); | 281 ssl_info_.cert.get(), web_contents_->GetRenderProcessHost()->GetID()); |
| 281 | 282 |
| 282 entry->GetSSL().security_style = | 283 entry->GetSSL().security_style = |
| 283 content::SECURITY_STYLE_AUTHENTICATION_BROKEN; | 284 content::SECURITY_STYLE_AUTHENTICATION_BROKEN; |
| 284 entry->GetSSL().cert_id = cert_id; | 285 entry->GetSSL().cert_id = cert_id; |
| 285 entry->GetSSL().cert_status = ssl_info_.cert_status; | 286 entry->GetSSL().cert_status = ssl_info_.cert_status; |
| 286 entry->GetSSL().security_bits = ssl_info_.security_bits; | 287 entry->GetSSL().security_bits = ssl_info_.security_bits; |
| 287 #if !defined(OS_ANDROID) | 288 #if !defined(OS_ANDROID) |
| 288 Browser* browser = chrome::FindBrowserWithWebContents(web_contents_); | 289 Browser* browser = chrome::FindBrowserWithWebContents(web_contents_); |
| 289 if (browser) | 290 if (browser) |
| 290 browser->VisibleSSLStateChanged(web_contents_); | 291 browser->VisibleSSLStateChanged(web_contents_); |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 360 "moreInfo1", "moreInfo2", "moreInfo3", "moreInfo4", "moreInfo5" | 361 "moreInfo1", "moreInfo2", "moreInfo3", "moreInfo4", "moreInfo5" |
| 361 }; | 362 }; |
| 362 int i; | 363 int i; |
| 363 for (i = 0; i < static_cast<int>(extra_info.size()); i++) { | 364 for (i = 0; i < static_cast<int>(extra_info.size()); i++) { |
| 364 strings->SetString(keys[i], extra_info[i]); | 365 strings->SetString(keys[i], extra_info[i]); |
| 365 } | 366 } |
| 366 for (; i < 5; i++) { | 367 for (; i < 5; i++) { |
| 367 strings->SetString(keys[i], std::string()); | 368 strings->SetString(keys[i], std::string()); |
| 368 } | 369 } |
| 369 } | 370 } |
| OLD | NEW |