OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/common/security_filter_peer.h" | 5 #include "chrome/common/security_filter_peer.h" |
6 | 6 |
7 #include "app/gfx/codec/png_codec.h" | 7 #include "app/gfx/codec/png_codec.h" |
8 #include "app/l10n_util.h" | 8 #include "app/l10n_util.h" |
9 #include "app/resource_bundle.h" | 9 #include "app/resource_bundle.h" |
10 #include "base/gfx/size.h" | 10 #include "base/gfx/size.h" |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 // For other errors, we use our normal error handling. | 85 // For other errors, we use our normal error handling. |
86 return NULL; | 86 return NULL; |
87 } | 87 } |
88 } | 88 } |
89 | 89 |
90 // static | 90 // static |
91 SecurityFilterPeer* SecurityFilterPeer::CreateSecurityFilterPeerForFrame( | 91 SecurityFilterPeer* SecurityFilterPeer::CreateSecurityFilterPeerForFrame( |
92 webkit_glue::ResourceLoaderBridge::Peer* peer, int os_error) { | 92 webkit_glue::ResourceLoaderBridge::Peer* peer, int os_error) { |
93 // TODO(jcampan): use a different message when getting a phishing/malware | 93 // TODO(jcampan): use a different message when getting a phishing/malware |
94 // error. | 94 // error. |
95 std::wstring error_msg = l10n_util::GetString(IDS_UNSAFE_FRAME_MESSAGE); | |
96 std::string html = StringPrintf( | 95 std::string html = StringPrintf( |
97 "<html><body style='background-color:#990000;color:white;'>" | 96 "<html><meta charset='UTF-8'>" |
| 97 "<body style='background-color:#990000;color:white;'>" |
98 "%s</body></html>", | 98 "%s</body></html>", |
99 WideToUTF8(error_msg).c_str()); | 99 l10n_util::GetStringUTF8(IDS_UNSAFE_FRAME_MESSAGE).c_str()); |
100 return new ReplaceContentPeer(NULL, peer, "text/html", html); | 100 return new ReplaceContentPeer(NULL, peer, "text/html", html); |
101 } | 101 } |
102 | 102 |
103 void SecurityFilterPeer::OnUploadProgress(uint64 position, uint64 size) { | 103 void SecurityFilterPeer::OnUploadProgress(uint64 position, uint64 size) { |
104 original_peer_->OnUploadProgress(position, size); | 104 original_peer_->OnUploadProgress(position, size); |
105 } | 105 } |
106 | 106 |
107 bool SecurityFilterPeer::OnReceivedRedirect( | 107 bool SecurityFilterPeer::OnReceivedRedirect( |
108 const GURL& new_url, | 108 const GURL& new_url, |
109 const webkit_glue::ResourceLoaderBridge::ResponseInfo& info) { | 109 const webkit_glue::ResourceLoaderBridge::ResponseInfo& info) { |
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
315 return false; | 315 return false; |
316 } | 316 } |
317 | 317 |
318 // Copy the vector content to data_ which is a string. | 318 // Copy the vector content to data_ which is a string. |
319 data_.clear(); | 319 data_.clear(); |
320 data_.resize(output.size()); | 320 data_.resize(output.size()); |
321 std::copy(output.begin(), output.end(), data_.begin()); | 321 std::copy(output.begin(), output.end(), data_.begin()); |
322 | 322 |
323 return true; | 323 return true; |
324 } | 324 } |
OLD | NEW |