| 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" |
| 11 #include "base/values.h" | 11 #include "base/values.h" |
| 12 #include "chrome/browser/profiles/profile.h" | 12 #include "chrome/browser/profiles/profile.h" |
| 13 #include "chrome/browser/renderer_preferences_util.h" | 13 #include "chrome/browser/renderer_preferences_util.h" |
| 14 #include "chrome/browser/ssl/ssl_error_info.h" | 14 #include "chrome/browser/ssl/ssl_error_info.h" |
| 15 #include "chrome/common/jstemplate_builder.h" | 15 #include "chrome/common/jstemplate_builder.h" |
| 16 #include "content/public/browser/cert_store.h" | 16 #include "content/public/browser/cert_store.h" |
| 17 #include "content/public/browser/interstitial_page.h" | 17 #include "content/public/browser/interstitial_page.h" |
| 18 #include "content/public/browser/navigation_controller.h" | 18 #include "content/public/browser/navigation_controller.h" |
| 19 #include "content/public/browser/navigation_entry.h" | 19 #include "content/public/browser/navigation_entry.h" |
| 20 #include "content/public/browser/notification_service.h" | 20 #include "content/public/browser/notification_service.h" |
| 21 #include "content/public/browser/notification_types.h" | 21 #include "content/public/browser/notification_types.h" |
| 22 #include "content/public/browser/render_process_host.h" | 22 #include "content/public/browser/render_process_host.h" |
| 23 #include "content/public/browser/render_view_host.h" | 23 #include "content/public/browser/render_view_host.h" |
| 24 #include "content/public/browser/web_contents.h" | 24 #include "content/public/browser/web_contents.h" |
| 25 #include "content/public/common/ssl_status.h" | 25 #include "content/public/common/ssl_status.h" |
| 26 #include "grit/browser_resources.h" | 26 #include "grit/browser_resources.h" |
| 27 #include "grit/generated_resources.h" | 27 #include "grit/generated_resources.h" |
| 28 #include "ui/base/l10n/l10n_util.h" | 28 #include "ui/base/l10n/l10n_util.h" |
| 29 #include "ui/base/layout.h" |
| 29 #include "ui/base/resource/resource_bundle.h" | 30 #include "ui/base/resource/resource_bundle.h" |
| 30 | 31 |
| 31 using content::InterstitialPage; | 32 using content::InterstitialPage; |
| 32 using content::NavigationController; | 33 using content::NavigationController; |
| 33 using content::NavigationEntry; | 34 using content::NavigationEntry; |
| 34 | 35 |
| 35 namespace { | 36 namespace { |
| 36 | 37 |
| 37 enum SSLBlockingPageEvent { | 38 enum SSLBlockingPageEvent { |
| 38 SHOW, | 39 SHOW, |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 strings.SetString("back", | 110 strings.SetString("back", |
| 110 l10n_util::GetStringUTF16(IDS_SSL_ERROR_PAGE_BACK)); | 111 l10n_util::GetStringUTF16(IDS_SSL_ERROR_PAGE_BACK)); |
| 111 strings.SetString("cannotProceed", | 112 strings.SetString("cannotProceed", |
| 112 l10n_util::GetStringUTF16( | 113 l10n_util::GetStringUTF16( |
| 113 IDS_SSL_ERROR_PAGE_CANNOT_PROCEED)); | 114 IDS_SSL_ERROR_PAGE_CANNOT_PROCEED)); |
| 114 } | 115 } |
| 115 | 116 |
| 116 strings.SetString("textdirection", base::i18n::IsRTL() ? "rtl" : "ltr"); | 117 strings.SetString("textdirection", base::i18n::IsRTL() ? "rtl" : "ltr"); |
| 117 | 118 |
| 118 base::StringPiece html( | 119 base::StringPiece html( |
| 119 ResourceBundle::GetSharedInstance().GetRawDataResource(resource_id)); | 120 ResourceBundle::GetSharedInstance().GetRawDataResource( |
| 121 resource_id, ui::kScaleFactorNone)); |
| 120 | 122 |
| 121 return jstemplate_builder::GetI18nTemplateHtml(html, &strings); | 123 return jstemplate_builder::GetI18nTemplateHtml(html, &strings); |
| 122 } | 124 } |
| 123 | 125 |
| 124 void SSLBlockingPage::OverrideEntry(NavigationEntry* entry) { | 126 void SSLBlockingPage::OverrideEntry(NavigationEntry* entry) { |
| 125 int cert_id = content::CertStore::GetInstance()->StoreCert( | 127 int cert_id = content::CertStore::GetInstance()->StoreCert( |
| 126 ssl_info_.cert, web_contents_->GetRenderProcessHost()->GetID()); | 128 ssl_info_.cert, web_contents_->GetRenderProcessHost()->GetID()); |
| 127 | 129 |
| 128 entry->GetSSL().security_style = | 130 entry->GetSSL().security_style = |
| 129 content::SECURITY_STYLE_AUTHENTICATION_BROKEN; | 131 content::SECURITY_STYLE_AUTHENTICATION_BROKEN; |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 191 "moreInfo1", "moreInfo2", "moreInfo3", "moreInfo4", "moreInfo5" | 193 "moreInfo1", "moreInfo2", "moreInfo3", "moreInfo4", "moreInfo5" |
| 192 }; | 194 }; |
| 193 int i; | 195 int i; |
| 194 for (i = 0; i < static_cast<int>(extra_info.size()); i++) { | 196 for (i = 0; i < static_cast<int>(extra_info.size()); i++) { |
| 195 strings->SetString(keys[i], extra_info[i]); | 197 strings->SetString(keys[i], extra_info[i]); |
| 196 } | 198 } |
| 197 for (; i < 5; i++) { | 199 for (; i < 5; i++) { |
| 198 strings->SetString(keys[i], ""); | 200 strings->SetString(keys[i], ""); |
| 199 } | 201 } |
| 200 } | 202 } |
| OLD | NEW |