Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(795)

Side by Side Diff: chrome/renderer/extensions/extension_localization_peer.cc

Issue 2341693002: Re-write many calls to WrapUnique() with MakeUnique() (Closed)
Patch Set: Fix one under-change and one mysterious revert Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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
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
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 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698