Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(181)

Side by Side Diff: chrome/browser/search_engines/template_url_fetcher.cc

Issue 338363004: Remove Profile* from TemplateURL (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address comments Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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/strings/string_number_conversions.h" 9 #include "base/strings/string_number_conversions.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 data.originating_url = osdd_url_; 189 data.originating_url = osdd_url_;
190 190
191 // The page may have specified a URL to use for favicons, if not, set it. 191 // The page may have specified a URL to use for favicons, if not, set it.
192 if (!data.favicon_url.is_valid()) 192 if (!data.favicon_url.is_valid())
193 data.favicon_url = favicon_url_; 193 data.favicon_url = favicon_url_;
194 194
195 switch (provider_type_) { 195 switch (provider_type_) {
196 case AUTODETECTED_PROVIDER: 196 case AUTODETECTED_PROVIDER:
197 // Mark the keyword as replaceable so it can be removed if necessary. 197 // Mark the keyword as replaceable so it can be removed if necessary.
198 data.safe_for_autoreplace = true; 198 data.safe_for_autoreplace = true;
199 model->Add(new TemplateURL(profile, data)); 199 model->Add(new TemplateURL(data));
200 break; 200 break;
201 201
202 case EXPLICIT_PROVIDER: 202 case EXPLICIT_PROVIDER:
203 // Confirm addition and allow user to edit default choices. It's ironic 203 // Confirm addition and allow user to edit default choices. It's ironic
204 // that only *non*-autodetected additions get confirmed, but the user 204 // that only *non*-autodetected additions get confirmed, but the user
205 // expects feedback that his action did something. 205 // expects feedback that his action did something.
206 // The source WebContents' delegate takes care of adding the URL to the 206 // The source WebContents' delegate takes care of adding the URL to the
207 // model, which takes ownership, or of deleting it if the add is 207 // model, which takes ownership, or of deleting it if the add is
208 // cancelled. 208 // cancelled.
209 callbacks_->ConfirmAddSearchProvider(new TemplateURL(profile, data), 209 callbacks_->ConfirmAddSearchProvider(new TemplateURL(data), profile);
210 profile);
211 break; 210 break;
212 211
213 default: 212 default:
214 NOTREACHED(); 213 NOTREACHED();
215 break; 214 break;
216 } 215 }
217 216
218 fetcher_->RequestCompleted(this); 217 fetcher_->RequestCompleted(this);
219 // WARNING: RequestCompleted deletes us. 218 // WARNING: RequestCompleted deletes us.
220 } 219 }
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after
276 owned_callbacks.release(), provider_type)); 275 owned_callbacks.release(), provider_type));
277 } 276 }
278 277
279 void TemplateURLFetcher::RequestCompleted(RequestDelegate* request) { 278 void TemplateURLFetcher::RequestCompleted(RequestDelegate* request) {
280 Requests::iterator i = 279 Requests::iterator i =
281 std::find(requests_.begin(), requests_.end(), request); 280 std::find(requests_.begin(), requests_.end(), request);
282 DCHECK(i != requests_.end()); 281 DCHECK(i != requests_.end());
283 requests_.weak_erase(i); 282 requests_.weak_erase(i);
284 delete request; 283 delete request;
285 } 284 }
OLDNEW
« no previous file with comments | « chrome/browser/search_engines/template_url.cc ('k') | chrome/browser/search_engines/template_url_fetcher_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698