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

Side by Side Diff: components/search_engines/template_url_fetcher.cc

Issue 2305813002: Remove ScopedVector from importer. (Closed)
Patch Set: pkasting Created 4 years, 3 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "components/search_engines/template_url_fetcher.h" 5 #include "components/search_engines/template_url_fetcher.h"
6 6
7 #include "base/macros.h" 7 #include "base/macros.h"
8 #include "base/memory/ptr_util.h" 8 #include "base/memory/ptr_util.h"
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 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
104 std::string data; 104 std::string data;
105 if (!source->GetStatus().is_success() || 105 if (!source->GetStatus().is_success() ||
106 ((source->GetResponseCode() != -1) && 106 ((source->GetResponseCode() != -1) &&
107 (source->GetResponseCode() != 200)) || 107 (source->GetResponseCode() != 200)) ||
108 !source->GetResponseAsString(&data)) { 108 !source->GetResponseAsString(&data)) {
109 fetcher_->RequestCompleted(this); 109 fetcher_->RequestCompleted(this);
110 // WARNING: RequestCompleted deletes us. 110 // WARNING: RequestCompleted deletes us.
111 return; 111 return;
112 } 112 }
113 113
114 template_url_.reset(TemplateURLParser::Parse( 114 template_url_ = TemplateURLParser::Parse(
115 fetcher_->template_url_service_->search_terms_data(), false, 115 fetcher_->template_url_service_->search_terms_data(), false, data.data(),
116 data.data(), data.length(), NULL)); 116 data.length(), nullptr);
117 if (!template_url_.get() || 117 if (!template_url_.get() ||
118 !template_url_->url_ref().SupportsReplacement( 118 !template_url_->url_ref().SupportsReplacement(
119 fetcher_->template_url_service_->search_terms_data())) { 119 fetcher_->template_url_service_->search_terms_data())) {
120 fetcher_->RequestCompleted(this); 120 fetcher_->RequestCompleted(this);
121 // WARNING: RequestCompleted deletes us. 121 // WARNING: RequestCompleted deletes us.
122 return; 122 return;
123 } 123 }
124 124
125 if (keyword_.empty()) { 125 if (keyword_.empty()) {
126 // Use the parser-generated new keyword from the URL in the OSDD for the 126 // Use the parser-generated new keyword from the URL in the OSDD for the
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 this, keyword, osdd_url, favicon_url, url_fetcher_customize_callback)); 217 this, keyword, osdd_url, favicon_url, url_fetcher_customize_callback));
218 } 218 }
219 219
220 void TemplateURLFetcher::RequestCompleted(RequestDelegate* request) { 220 void TemplateURLFetcher::RequestCompleted(RequestDelegate* request) {
221 Requests::iterator i = 221 Requests::iterator i =
222 std::find(requests_.begin(), requests_.end(), request); 222 std::find(requests_.begin(), requests_.end(), request);
223 DCHECK(i != requests_.end()); 223 DCHECK(i != requests_.end());
224 requests_.weak_erase(i); 224 requests_.weak_erase(i);
225 delete request; 225 delete request;
226 } 226 }
OLDNEW
« no previous file with comments | « chrome/browser/search_engines/template_url_parser_unittest.cc ('k') | components/search_engines/template_url_parser.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698