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

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

Issue 2315443003: Stop sending serialized SSLStatus to the renderer. (Closed)
Patch Set: self review fix and merge fix 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 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 86
87 void ExtensionLocalizationPeer::OnReceivedData( 87 void ExtensionLocalizationPeer::OnReceivedData(
88 std::unique_ptr<ReceivedData> data) { 88 std::unique_ptr<ReceivedData> data) {
89 data_.append(data->payload(), data->length()); 89 data_.append(data->payload(), data->length());
90 } 90 }
91 91
92 void ExtensionLocalizationPeer::OnCompletedRequest( 92 void ExtensionLocalizationPeer::OnCompletedRequest(
93 int error_code, 93 int error_code,
94 bool was_ignored_by_handler, 94 bool was_ignored_by_handler,
95 bool stale_copy_in_cache, 95 bool stale_copy_in_cache,
96 const std::string& security_info,
97 const base::TimeTicks& completion_time, 96 const base::TimeTicks& completion_time,
98 int64_t total_transfer_size) { 97 int64_t total_transfer_size) {
99 // Give sub-classes a chance at altering the data. 98 // Give sub-classes a chance at altering the data.
100 if (error_code != net::OK) { 99 if (error_code != net::OK) {
101 // We failed to load the resource. 100 // We failed to load the resource.
102 original_peer_->OnReceivedResponse(response_info_); 101 original_peer_->OnReceivedResponse(response_info_);
103 original_peer_->OnCompletedRequest(net::ERR_ABORTED, false, 102 original_peer_->OnCompletedRequest(net::ERR_ABORTED, false,
104 stale_copy_in_cache, security_info, 103 stale_copy_in_cache, completion_time,
105 completion_time, total_transfer_size); 104 total_transfer_size);
106 return; 105 return;
107 } 106 }
108 107
109 ReplaceMessages(); 108 ReplaceMessages();
110 109
111 original_peer_->OnReceivedResponse(response_info_); 110 original_peer_->OnReceivedResponse(response_info_);
112 if (!data_.empty()) 111 if (!data_.empty())
113 original_peer_->OnReceivedData(base::WrapUnique(new StringData(data_))); 112 original_peer_->OnReceivedData(base::WrapUnique(new StringData(data_)));
114 original_peer_->OnCompletedRequest(error_code, was_ignored_by_handler, 113 original_peer_->OnCompletedRequest(error_code, was_ignored_by_handler,
115 stale_copy_in_cache, security_info, 114 stale_copy_in_cache, completion_time,
116 completion_time, total_transfer_size); 115 total_transfer_size);
117 } 116 }
118 117
119 void ExtensionLocalizationPeer::ReplaceMessages() { 118 void ExtensionLocalizationPeer::ReplaceMessages() {
120 if (!message_sender_ || data_.empty()) 119 if (!message_sender_ || data_.empty())
121 return; 120 return;
122 121
123 if (!request_url_.is_valid()) 122 if (!request_url_.is_valid())
124 return; 123 return;
125 124
126 std::string extension_id = request_url_.host(); 125 std::string extension_id = request_url_.host();
(...skipping 12 matching lines...) Expand all
139 138
140 l10n_messages = extensions::GetL10nMessagesMap(extension_id); 139 l10n_messages = extensions::GetL10nMessagesMap(extension_id);
141 } 140 }
142 141
143 std::string error; 142 std::string error;
144 if (extensions::MessageBundle::ReplaceMessagesWithExternalDictionary( 143 if (extensions::MessageBundle::ReplaceMessagesWithExternalDictionary(
145 *l10n_messages, &data_, &error)) { 144 *l10n_messages, &data_, &error)) {
146 data_.resize(data_.size()); 145 data_.resize(data_.size());
147 } 146 }
148 } 147 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698