OLD | NEW |
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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 const std::string& security_info, | 70 const std::string& security_info, |
71 const base::Time& completion_time) { | 71 const base::TimeTicks& completion_time) { |
72 // Make sure we delete ourselves at the end of this call. | 72 // Make sure we delete ourselves at the end of this call. |
73 scoped_ptr<ExtensionLocalizationPeer> this_deleter(this); | 73 scoped_ptr<ExtensionLocalizationPeer> this_deleter(this); |
74 | 74 |
75 // Give sub-classes a chance at altering the data. | 75 // Give sub-classes a chance at altering the data. |
76 if (status.status() != net::URLRequestStatus::SUCCESS) { | 76 if (status.status() != net::URLRequestStatus::SUCCESS) { |
77 // We failed to load the resource. | 77 // We failed to load the resource. |
78 original_peer_->OnReceivedResponse(response_info_); | 78 original_peer_->OnReceivedResponse(response_info_); |
79 net::URLRequestStatus status(net::URLRequestStatus::CANCELED, | 79 net::URLRequestStatus status(net::URLRequestStatus::CANCELED, |
80 net::ERR_ABORTED); | 80 net::ERR_ABORTED); |
81 original_peer_->OnCompletedRequest(status, security_info, completion_time); | 81 original_peer_->OnCompletedRequest(status, security_info, completion_time); |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
114 | 114 |
115 l10n_messages = GetL10nMessagesMap(extension_id); | 115 l10n_messages = GetL10nMessagesMap(extension_id); |
116 } | 116 } |
117 | 117 |
118 std::string error; | 118 std::string error; |
119 if (ExtensionMessageBundle::ReplaceMessagesWithExternalDictionary( | 119 if (ExtensionMessageBundle::ReplaceMessagesWithExternalDictionary( |
120 *l10n_messages, &data_, &error)) { | 120 *l10n_messages, &data_, &error)) { |
121 data_.resize(data_.size()); | 121 data_.resize(data_.size()); |
122 } | 122 } |
123 } | 123 } |
OLD | NEW |