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 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 if (strict_enforcement_) { | 114 if (strict_enforcement_) { |
114 strings.SetString("cannotProceed", | 115 strings.SetString("cannotProceed", |
115 l10n_util::GetStringUTF16( | 116 l10n_util::GetStringUTF16( |
116 IDS_SSL_ERROR_PAGE_CANNOT_PROCEED)); | 117 IDS_SSL_ERROR_PAGE_CANNOT_PROCEED)); |
117 } | 118 } |
118 } | 119 } |
119 | 120 |
120 strings.SetString("textdirection", base::i18n::IsRTL() ? "rtl" : "ltr"); | 121 strings.SetString("textdirection", base::i18n::IsRTL() ? "rtl" : "ltr"); |
121 | 122 |
122 base::StringPiece html( | 123 base::StringPiece html( |
123 ResourceBundle::GetSharedInstance().GetRawDataResource(resource_id)); | 124 ResourceBundle::GetSharedInstance().GetRawDataResource( |
| 125 resource_id, ui::SCALE_FACTOR_NONE)); |
124 | 126 |
125 return jstemplate_builder::GetI18nTemplateHtml(html, &strings); | 127 return jstemplate_builder::GetI18nTemplateHtml(html, &strings); |
126 } | 128 } |
127 | 129 |
128 void SSLBlockingPage::OverrideEntry(NavigationEntry* entry) { | 130 void SSLBlockingPage::OverrideEntry(NavigationEntry* entry) { |
129 int cert_id = content::CertStore::GetInstance()->StoreCert( | 131 int cert_id = content::CertStore::GetInstance()->StoreCert( |
130 ssl_info_.cert, web_contents_->GetRenderProcessHost()->GetID()); | 132 ssl_info_.cert, web_contents_->GetRenderProcessHost()->GetID()); |
131 | 133 |
132 entry->GetSSL().security_style = | 134 entry->GetSSL().security_style = |
133 content::SECURITY_STYLE_AUTHENTICATION_BROKEN; | 135 content::SECURITY_STYLE_AUTHENTICATION_BROKEN; |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 "moreInfo1", "moreInfo2", "moreInfo3", "moreInfo4", "moreInfo5" | 197 "moreInfo1", "moreInfo2", "moreInfo3", "moreInfo4", "moreInfo5" |
196 }; | 198 }; |
197 int i; | 199 int i; |
198 for (i = 0; i < static_cast<int>(extra_info.size()); i++) { | 200 for (i = 0; i < static_cast<int>(extra_info.size()); i++) { |
199 strings->SetString(keys[i], extra_info[i]); | 201 strings->SetString(keys[i], extra_info[i]); |
200 } | 202 } |
201 for (; i < 5; i++) { | 203 for (; i < 5; i++) { |
202 strings->SetString(keys[i], ""); | 204 strings->SetString(keys[i], ""); |
203 } | 205 } |
204 } | 206 } |
OLD | NEW |