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

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

Issue 10640019: Remove the HANDLED_EXTERNALLY status code. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: hack, hack, hack Created 8 years, 6 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 (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/extensions/extension_localization_peer.h" 5 #include "chrome/common/extensions/extension_localization_peer.h"
6 6
7 #include "base/memory/scoped_ptr.h" 7 #include "base/memory/scoped_ptr.h"
8 #include "base/string_util.h" 8 #include "base/string_util.h"
9 #include "chrome/common/extensions/extension_message_bundle.h" 9 #include "chrome/common/extensions/extension_message_bundle.h"
10 #include "chrome/common/extensions/extension_messages.h" 10 #include "chrome/common/extensions/extension_messages.h"
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 } 60 }
61 61
62 void ExtensionLocalizationPeer::OnReceivedData(const char* data, 62 void ExtensionLocalizationPeer::OnReceivedData(const char* data,
63 int data_length, 63 int data_length,
64 int encoded_data_length) { 64 int encoded_data_length) {
65 data_.append(data, data_length); 65 data_.append(data, data_length);
66 } 66 }
67 67
68 void ExtensionLocalizationPeer::OnCompletedRequest( 68 void ExtensionLocalizationPeer::OnCompletedRequest(
69 const net::URLRequestStatus& status, 69 const net::URLRequestStatus& status,
70 bool handled_externally,
70 const std::string& security_info, 71 const std::string& security_info,
71 const base::TimeTicks& completion_time) { 72 const base::TimeTicks& completion_time) {
72 // Make sure we delete ourselves at the end of this call. 73 // Make sure we delete ourselves at the end of this call.
73 scoped_ptr<ExtensionLocalizationPeer> this_deleter(this); 74 scoped_ptr<ExtensionLocalizationPeer> this_deleter(this);
74 75
75 // Give sub-classes a chance at altering the data. 76 // Give sub-classes a chance at altering the data.
76 if (status.status() != net::URLRequestStatus::SUCCESS) { 77 if (status.status() != net::URLRequestStatus::SUCCESS) {
77 // We failed to load the resource. 78 // We failed to load the resource.
78 original_peer_->OnReceivedResponse(response_info_); 79 original_peer_->OnReceivedResponse(response_info_);
79 net::URLRequestStatus status(net::URLRequestStatus::CANCELED, 80 net::URLRequestStatus status(net::URLRequestStatus::CANCELED,
80 net::ERR_ABORTED); 81 net::ERR_ABORTED);
81 original_peer_->OnCompletedRequest(status, security_info, completion_time); 82 original_peer_->OnCompletedRequest(status, handled_externally,
83 security_info, completion_time);
82 return; 84 return;
83 } 85 }
84 86
85 ReplaceMessages(); 87 ReplaceMessages();
86 88
87 original_peer_->OnReceivedResponse(response_info_); 89 original_peer_->OnReceivedResponse(response_info_);
88 if (!data_.empty()) 90 if (!data_.empty())
89 original_peer_->OnReceivedData(data_.data(), 91 original_peer_->OnReceivedData(data_.data(),
90 static_cast<int>(data_.size()), 92 static_cast<int>(data_.size()),
91 -1); 93 -1);
92 original_peer_->OnCompletedRequest(status, security_info, completion_time); 94 original_peer_->OnCompletedRequest(status, handled_externally,
95 security_info, completion_time);
93 } 96 }
94 97
95 void ExtensionLocalizationPeer::ReplaceMessages() { 98 void ExtensionLocalizationPeer::ReplaceMessages() {
96 if (!message_sender_ || data_.empty()) 99 if (!message_sender_ || data_.empty())
97 return; 100 return;
98 101
99 if (!request_url_.is_valid()) 102 if (!request_url_.is_valid())
100 return; 103 return;
101 104
102 std::string extension_id = request_url_.host(); 105 std::string extension_id = request_url_.host();
(...skipping 11 matching lines...) Expand all
114 117
115 l10n_messages = GetL10nMessagesMap(extension_id); 118 l10n_messages = GetL10nMessagesMap(extension_id);
116 } 119 }
117 120
118 std::string error; 121 std::string error;
119 if (ExtensionMessageBundle::ReplaceMessagesWithExternalDictionary( 122 if (ExtensionMessageBundle::ReplaceMessagesWithExternalDictionary(
120 *l10n_messages, &data_, &error)) { 123 *l10n_messages, &data_, &error)) {
121 data_.resize(data_.size()); 124 data_.resize(data_.size());
122 } 125 }
123 } 126 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698