| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/renderer/extensions/extension_localization_peer.h" | 5 #include "chrome/renderer/extensions/extension_localization_peer.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/macros.h" | 10 #include "base/macros.h" |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 original_peer_->OnCompletedRequest(net::ERR_ABORTED, false, | 102 original_peer_->OnCompletedRequest(net::ERR_ABORTED, false, |
| 103 stale_copy_in_cache, completion_time, | 103 stale_copy_in_cache, completion_time, |
| 104 total_transfer_size); | 104 total_transfer_size); |
| 105 return; | 105 return; |
| 106 } | 106 } |
| 107 | 107 |
| 108 ReplaceMessages(); | 108 ReplaceMessages(); |
| 109 | 109 |
| 110 original_peer_->OnReceivedResponse(response_info_); | 110 original_peer_->OnReceivedResponse(response_info_); |
| 111 if (!data_.empty()) | 111 if (!data_.empty()) |
| 112 original_peer_->OnReceivedData(base::WrapUnique(new StringData(data_))); | 112 original_peer_->OnReceivedData(base::MakeUnique<StringData>(data_)); |
| 113 original_peer_->OnCompletedRequest(error_code, was_ignored_by_handler, | 113 original_peer_->OnCompletedRequest(error_code, was_ignored_by_handler, |
| 114 stale_copy_in_cache, completion_time, | 114 stale_copy_in_cache, completion_time, |
| 115 total_transfer_size); | 115 total_transfer_size); |
| 116 } | 116 } |
| 117 | 117 |
| 118 void ExtensionLocalizationPeer::ReplaceMessages() { | 118 void ExtensionLocalizationPeer::ReplaceMessages() { |
| 119 if (!message_sender_ || data_.empty()) | 119 if (!message_sender_ || data_.empty()) |
| 120 return; | 120 return; |
| 121 | 121 |
| 122 if (!request_url_.is_valid()) | 122 if (!request_url_.is_valid()) |
| (...skipping 15 matching lines...) Expand all Loading... |
| 138 | 138 |
| 139 l10n_messages = extensions::GetL10nMessagesMap(extension_id); | 139 l10n_messages = extensions::GetL10nMessagesMap(extension_id); |
| 140 } | 140 } |
| 141 | 141 |
| 142 std::string error; | 142 std::string error; |
| 143 if (extensions::MessageBundle::ReplaceMessagesWithExternalDictionary( | 143 if (extensions::MessageBundle::ReplaceMessagesWithExternalDictionary( |
| 144 *l10n_messages, &data_, &error)) { | 144 *l10n_messages, &data_, &error)) { |
| 145 data_.resize(data_.size()); | 145 data_.resize(data_.size()); |
| 146 } | 146 } |
| 147 } | 147 } |
| OLD | NEW |