| 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 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 101 // Start the model load and set-up waiting for it. | 101 // Start the model load and set-up waiting for it. |
| 102 registrar_.Add(this, | 102 registrar_.Add(this, |
| 103 chrome::NOTIFICATION_TEMPLATE_URL_SERVICE_LOADED, | 103 chrome::NOTIFICATION_TEMPLATE_URL_SERVICE_LOADED, |
| 104 content::Source<TemplateURLService>(model)); | 104 content::Source<TemplateURLService>(model)); |
| 105 model->Load(); | 105 model->Load(); |
| 106 } | 106 } |
| 107 | 107 |
| 108 url_fetcher_->SetRequestContext(fetcher->profile()->GetRequestContext()); | 108 url_fetcher_->SetRequestContext(fetcher->profile()->GetRequestContext()); |
| 109 // Can be NULL during tests. | 109 // Can be NULL during tests. |
| 110 if (web_contents) { | 110 if (web_contents) { |
| 111 url_fetcher_->AssociateWithRenderView( | 111 content::AssociateWithRenderView( |
| 112 url_fetcher_.get(), |
| 112 web_contents->GetURL(), | 113 web_contents->GetURL(), |
| 113 web_contents->GetRenderProcessHost()->GetID(), | 114 web_contents->GetRenderProcessHost()->GetID(), |
| 114 web_contents->GetRenderViewHost()->GetRoutingID()); | 115 web_contents->GetRenderViewHost()->GetRoutingID()); |
| 115 } | 116 } |
| 116 | 117 |
| 117 url_fetcher_->Start(); | 118 url_fetcher_->Start(); |
| 118 } | 119 } |
| 119 | 120 |
| 120 void TemplateURLFetcher::RequestDelegate::Observe( | 121 void TemplateURLFetcher::RequestDelegate::Observe( |
| 121 int type, | 122 int type, |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 286 owned_callbacks.release(), provider_type)); | 287 owned_callbacks.release(), provider_type)); |
| 287 } | 288 } |
| 288 | 289 |
| 289 void TemplateURLFetcher::RequestCompleted(RequestDelegate* request) { | 290 void TemplateURLFetcher::RequestCompleted(RequestDelegate* request) { |
| 290 Requests::iterator i = | 291 Requests::iterator i = |
| 291 std::find(requests_->begin(), requests_->end(), request); | 292 std::find(requests_->begin(), requests_->end(), request); |
| 292 DCHECK(i != requests_->end()); | 293 DCHECK(i != requests_->end()); |
| 293 requests_->erase(i); | 294 requests_->erase(i); |
| 294 delete request; | 295 delete request; |
| 295 } | 296 } |
| OLD | NEW |