OLD | NEW |
1 // Copyright (C) 2013 Google Inc. | 1 // Copyright (C) 2013 Google Inc. |
2 // | 2 // |
3 // Licensed under the Apache License, Version 2.0 (the "License"); | 3 // Licensed under the Apache License, Version 2.0 (the "License"); |
4 // you may not use this file except in compliance with the License. | 4 // you may not use this file except in compliance with the License. |
5 // You may obtain a copy of the License at | 5 // You may obtain a copy of the License at |
6 // | 6 // |
7 // http://www.apache.org/licenses/LICENSE-2.0 | 7 // http://www.apache.org/licenses/LICENSE-2.0 |
8 // | 8 // |
9 // Unless required by applicable law or agreed to in writing, software | 9 // Unless required by applicable law or agreed to in writing, software |
10 // distributed under the License is distributed on an "AS IS" BASIS, | 10 // distributed under the License is distributed on an "AS IS" BASIS, |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
145 return false; | 145 return false; |
146 } | 146 } |
147 | 147 |
148 return checksum == MD5String(**data); | 148 return checksum == MD5String(**data); |
149 } | 149 } |
150 | 150 |
151 } // namespace | 151 } // namespace |
152 | 152 |
153 Retriever::Retriever(const std::string& validation_data_url, | 153 Retriever::Retriever(const std::string& validation_data_url, |
154 scoped_ptr<Downloader> downloader, | 154 scoped_ptr<Downloader> downloader, |
155 scoped_ptr<Storage> storage) | 155 Storage* storage) |
156 : validation_data_url_(validation_data_url), | 156 : validation_data_url_(validation_data_url), |
157 downloader_(downloader.Pass()), | 157 downloader_(downloader.Pass()), |
158 storage_(storage.Pass()), | 158 storage_(storage), |
159 stale_data_() { | 159 stale_data_() { |
160 assert(validation_data_url_.length() > 0); | 160 assert(validation_data_url_.length() > 0); |
161 assert(validation_data_url_[validation_data_url_.length() - 1] == '/'); | 161 assert(validation_data_url_[validation_data_url_.length() - 1] == '/'); |
162 assert(storage_ != NULL); | 162 assert(storage_ != NULL); |
163 assert(downloader_ != NULL); | 163 assert(downloader_ != NULL); |
164 } | 164 } |
165 | 165 |
166 Retriever::~Retriever() { | 166 Retriever::~Retriever() { |
167 STLDeleteValues(&requests_); | 167 STLDeleteValues(&requests_); |
168 } | 168 } |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
254 scoped_ptr<Callback> callback(iter->second); | 254 scoped_ptr<Callback> callback(iter->second); |
255 requests_.erase(iter); | 255 requests_.erase(iter); |
256 if (callback == NULL) { | 256 if (callback == NULL) { |
257 return; | 257 return; |
258 } | 258 } |
259 (*callback)(success, key, data); | 259 (*callback)(success, key, data); |
260 } | 260 } |
261 | 261 |
262 } // namespace addressinput | 262 } // namespace addressinput |
263 } // namespace i18n | 263 } // namespace i18n |
OLD | NEW |