OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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_policy.h" | 5 #include "chrome/browser/ssl/ssl_policy.h" |
6 | 6 |
7 #include "base/singleton.h" | 7 #include "base/singleton.h" |
8 #include "base/string_piece.h" | 8 #include "base/string_piece.h" |
9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
10 #include "chrome/browser/cert_store.h" | 10 #include "chrome/browser/cert_store.h" |
11 #include "chrome/browser/renderer_host/render_view_host.h" | 11 #include "chrome/browser/renderer_host/render_view_host.h" |
12 #include "chrome/browser/ssl/ssl_error_info.h" | 12 #include "chrome/browser/ssl/ssl_error_info.h" |
13 #include "chrome/browser/tab_contents/navigation_entry.h" | 13 #include "chrome/browser/tab_contents/navigation_entry.h" |
14 #include "chrome/browser/tab_contents/web_contents.h" | 14 #include "chrome/browser/tab_contents/web_contents.h" |
15 #include "chrome/common/jstemplate_builder.h" | 15 #include "chrome/common/jstemplate_builder.h" |
16 #include "chrome/common/l10n_util.h" | 16 #include "chrome/common/l10n_util.h" |
17 #include "chrome/common/notification_service.h" | 17 #include "chrome/common/notification_service.h" |
18 #include "chrome/common/pref_names.h" | 18 #include "chrome/common/pref_names.h" |
19 #include "chrome/common/pref_service.h" | 19 #include "chrome/common/pref_service.h" |
20 #include "chrome/common/resource_bundle.h" | 20 #include "chrome/common/resource_bundle.h" |
21 #include "chrome/common/chrome_switches.h" | 21 #include "chrome/common/chrome_switches.h" |
22 #include "chrome/common/time_format.h" | 22 #include "chrome/common/time_format.h" |
23 #include "chrome/common/url_constants.h" | 23 #include "chrome/common/url_constants.h" |
24 #include "grit/browser_resources.h" | 24 #include "grit/browser_resources.h" |
25 #include "grit/generated_resources.h" | 25 #include "grit/generated_resources.h" |
26 #include "net/base/cert_status_flags.h" | 26 #include "net/base/cert_status_flags.h" |
27 #include "net/base/ssl_info.h" | 27 #include "net/base/ssl_info.h" |
28 #include "third_party/WebKit/WebKit/chromium/public/WebConsoleMessage.h" | |
29 #include "webkit/glue/resource_type.h" | 28 #include "webkit/glue/resource_type.h" |
30 | 29 |
31 #if defined(OS_WIN) | 30 #if defined(OS_WIN) |
32 // TODO(port): port these files. | 31 // TODO(port): port these files. |
33 #include "chrome/browser/tab_contents/tab_contents.h" | 32 #include "chrome/browser/tab_contents/tab_contents.h" |
34 #elif defined(OS_POSIX) | 33 #elif defined(OS_POSIX) |
35 #include "chrome/common/temp_scaffolding_stubs.h" | 34 #include "chrome/common/temp_scaffolding_stubs.h" |
36 #endif | 35 #endif |
37 | 36 |
38 using WebKit::WebConsoleMessage; | 37 using WebKit::WebConsoleMessage; |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 entry->ssl().set_security_style(entry->url().SchemeIsSecure() ? | 157 entry->ssl().set_security_style(entry->url().SchemeIsSecure() ? |
159 SECURITY_STYLE_AUTHENTICATED : SECURITY_STYLE_UNAUTHENTICATED); | 158 SECURITY_STYLE_AUTHENTICATED : SECURITY_STYLE_UNAUTHENTICATED); |
160 } | 159 } |
161 | 160 |
162 static void AddMixedContentWarningToConsole( | 161 static void AddMixedContentWarningToConsole( |
163 SSLManager::MixedContentHandler* handler) { | 162 SSLManager::MixedContentHandler* handler) { |
164 const std::wstring& text = l10n_util::GetStringF( | 163 const std::wstring& text = l10n_util::GetStringF( |
165 IDS_MIXED_CONTENT_LOG_MESSAGE, | 164 IDS_MIXED_CONTENT_LOG_MESSAGE, |
166 UTF8ToWide(handler->frame_origin()), | 165 UTF8ToWide(handler->frame_origin()), |
167 UTF8ToWide(handler->request_url().spec())); | 166 UTF8ToWide(handler->request_url().spec())); |
168 WebConsoleMessage message; | 167 handler->manager()->AddMessageToConsole( |
169 message.text = WideToUTF16Hack(text); | 168 WideToUTF16Hack(text), WebConsoleMessage::LevelWarning); |
170 message.level = WebConsoleMessage::LevelWarning; | |
171 handler->manager()->AddMessageToConsole(message); | |
172 } | 169 } |
173 | 170 |
174 } // namespace | 171 } // namespace |
175 | 172 |
176 SSLPolicy::SSLPolicy() { | 173 SSLPolicy::SSLPolicy() { |
177 } | 174 } |
178 | 175 |
179 SSLPolicy* SSLPolicy::GetDefaultPolicy() { | 176 SSLPolicy* SSLPolicy::GetDefaultPolicy() { |
180 return Singleton<SSLPolicy>::get(); | 177 return Singleton<SSLPolicy>::get(); |
181 } | 178 } |
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
366 | 363 |
367 void SSLPolicy::OnFatalCertError(SSLManager::CertError* error) { | 364 void SSLPolicy::OnFatalCertError(SSLManager::CertError* error) { |
368 if (error->resource_type() != ResourceType::MAIN_FRAME) { | 365 if (error->resource_type() != ResourceType::MAIN_FRAME) { |
369 error->DenyRequest(); | 366 error->DenyRequest(); |
370 return; | 367 return; |
371 } | 368 } |
372 error->CancelRequest(); | 369 error->CancelRequest(); |
373 ShowErrorPage(this, error); | 370 ShowErrorPage(this, error); |
374 // No need to degrade our security indicators because we didn't continue. | 371 // No need to degrade our security indicators because we didn't continue. |
375 } | 372 } |
OLD | NEW |