| 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 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 case AUTODETECTED_PROVIDER: | 206 case AUTODETECTED_PROVIDER: |
| 207 // Mark the keyword as replaceable so it can be removed if necessary. | 207 // Mark the keyword as replaceable so it can be removed if necessary. |
| 208 data.safe_for_autoreplace = true; | 208 data.safe_for_autoreplace = true; |
| 209 model->Add(new TemplateURL(data)); | 209 model->Add(new TemplateURL(data)); |
| 210 break; | 210 break; |
| 211 | 211 |
| 212 case EXPLICIT_PROVIDER: | 212 case EXPLICIT_PROVIDER: |
| 213 // Confirm addition and allow user to edit default choices. It's ironic | 213 // Confirm addition and allow user to edit default choices. It's ironic |
| 214 // that only *non*-autodetected additions get confirmed, but the user | 214 // that only *non*-autodetected additions get confirmed, but the user |
| 215 // expects feedback that his action did something. | 215 // expects feedback that his action did something. |
| 216 // The source TabContents' delegate takes care of adding the URL to the | 216 // The source WebContents' delegate takes care of adding the URL to the |
| 217 // model, which takes ownership, or of deleting it if the add is | 217 // model, which takes ownership, or of deleting it if the add is |
| 218 // cancelled. | 218 // cancelled. |
| 219 callbacks_->ConfirmAddSearchProvider(new TemplateURL(data), | 219 callbacks_->ConfirmAddSearchProvider(new TemplateURL(data), |
| 220 fetcher_->profile()); | 220 fetcher_->profile()); |
| 221 break; | 221 break; |
| 222 | 222 |
| 223 default: | 223 default: |
| 224 NOTREACHED(); | 224 NOTREACHED(); |
| 225 break; | 225 break; |
| 226 } | 226 } |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 286 owned_callbacks.release(), provider_type)); | 286 owned_callbacks.release(), provider_type)); |
| 287 } | 287 } |
| 288 | 288 |
| 289 void TemplateURLFetcher::RequestCompleted(RequestDelegate* request) { | 289 void TemplateURLFetcher::RequestCompleted(RequestDelegate* request) { |
| 290 Requests::iterator i = | 290 Requests::iterator i = |
| 291 std::find(requests_->begin(), requests_->end(), request); | 291 std::find(requests_->begin(), requests_->end(), request); |
| 292 DCHECK(i != requests_->end()); | 292 DCHECK(i != requests_->end()); |
| 293 requests_->erase(i); | 293 requests_->erase(i); |
| 294 delete request; | 294 delete request; |
| 295 } | 295 } |
| OLD | NEW |