OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "build/build_config.h" | 5 #include "build/build_config.h" |
6 | 6 |
7 #include "chrome/browser/search_engines/template_url_fetcher.h" | 7 #include "chrome/browser/search_engines/template_url_fetcher.h" |
8 | 8 |
9 #include "base/string_number_conversions.h" | 9 #include "base/string_number_conversions.h" |
10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
269 } | 269 } |
270 | 270 |
271 const TemplateURL* template_url = | 271 const TemplateURL* template_url = |
272 url_model->GetTemplateURLForKeyword(keyword); | 272 url_model->GetTemplateURLForKeyword(keyword); |
273 if (template_url && (!template_url->safe_for_autoreplace() || | 273 if (template_url && (!template_url->safe_for_autoreplace() || |
274 template_url->originating_url() == osdd_url)) | 274 template_url->originating_url() == osdd_url)) |
275 return; | 275 return; |
276 } | 276 } |
277 | 277 |
278 // Make sure we aren't already downloading this request. | 278 // Make sure we aren't already downloading this request. |
279 for (Requests::iterator i = requests_->begin(); i != requests_->end(); ++i) { | 279 for (Requests::iterator i = requests_.begin(); i != requests_.end(); ++i) { |
280 if (((*i)->url() == osdd_url) || | 280 if (((*i)->url() == osdd_url) || |
281 ((provider_type == TemplateURLFetcher::AUTODETECTED_PROVIDER) && | 281 ((provider_type == TemplateURLFetcher::AUTODETECTED_PROVIDER) && |
282 ((*i)->keyword() == keyword))) | 282 ((*i)->keyword() == keyword))) |
283 return; | 283 return; |
284 } | 284 } |
285 | 285 |
286 requests_->push_back( | 286 requests_.push_back( |
287 new RequestDelegate(this, keyword, osdd_url, favicon_url, web_contents, | 287 new RequestDelegate(this, keyword, osdd_url, favicon_url, web_contents, |
288 owned_callbacks.release(), provider_type)); | 288 owned_callbacks.release(), provider_type)); |
289 } | 289 } |
290 | 290 |
291 void TemplateURLFetcher::RequestCompleted(RequestDelegate* request) { | 291 void TemplateURLFetcher::RequestCompleted(RequestDelegate* request) { |
292 Requests::iterator i = | 292 Requests::iterator i = |
293 std::find(requests_->begin(), requests_->end(), request); | 293 std::find(requests_.begin(), requests_.end(), request); |
294 DCHECK(i != requests_->end()); | 294 DCHECK(i != requests_.end()); |
295 requests_->erase(i); | 295 requests_.weak_erase(i); |
296 delete request; | 296 delete request; |
297 } | 297 } |
OLD | NEW |