OLD | NEW |
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/util.h" | 5 #include "components/search_engines/util.h" |
6 | 6 |
| 7 #include <stddef.h> |
| 8 #include <stdint.h> |
| 9 |
7 #include <map> | 10 #include <map> |
8 #include <set> | 11 #include <set> |
9 #include <string> | 12 #include <string> |
10 #include <vector> | 13 #include <vector> |
11 | 14 |
12 #include "base/logging.h" | 15 #include "base/logging.h" |
13 #include "base/memory/scoped_vector.h" | 16 #include "base/memory/scoped_vector.h" |
14 #include "base/prefs/pref_service.h" | 17 #include "base/prefs/pref_service.h" |
15 #include "base/time/time.h" | 18 #include "base/time/time.h" |
16 #include "components/search_engines/template_url.h" | 19 #include "components/search_engines/template_url.h" |
(...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 } | 138 } |
136 | 139 |
137 // Return the checked URLs. | 140 // Return the checked URLs. |
138 template_urls->swap(checked_urls); | 141 template_urls->swap(checked_urls); |
139 } | 142 } |
140 | 143 |
141 // Returns the TemplateURL with id specified from the list of TemplateURLs. | 144 // Returns the TemplateURL with id specified from the list of TemplateURLs. |
142 // If not found, returns NULL. | 145 // If not found, returns NULL. |
143 TemplateURL* GetTemplateURLByID( | 146 TemplateURL* GetTemplateURLByID( |
144 const TemplateURLService::TemplateURLVector& template_urls, | 147 const TemplateURLService::TemplateURLVector& template_urls, |
145 int64 id) { | 148 int64_t id) { |
146 for (TemplateURLService::TemplateURLVector::const_iterator i( | 149 for (TemplateURLService::TemplateURLVector::const_iterator i( |
147 template_urls.begin()); i != template_urls.end(); ++i) { | 150 template_urls.begin()); i != template_urls.end(); ++i) { |
148 if ((*i)->id() == id) { | 151 if ((*i)->id() == id) { |
149 return *i; | 152 return *i; |
150 } | 153 } |
151 } | 154 } |
152 return NULL; | 155 return NULL; |
153 } | 156 } |
154 | 157 |
155 TemplateURL* FindURLByPrepopulateID( | 158 TemplateURL* FindURLByPrepopulateID( |
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
380 std::vector<std::string> deduped_encodings; | 383 std::vector<std::string> deduped_encodings; |
381 std::set<std::string> encoding_set; | 384 std::set<std::string> encoding_set; |
382 for (std::vector<std::string>::const_iterator i(encodings->begin()); | 385 for (std::vector<std::string>::const_iterator i(encodings->begin()); |
383 i != encodings->end(); ++i) { | 386 i != encodings->end(); ++i) { |
384 if (encoding_set.insert(*i).second) | 387 if (encoding_set.insert(*i).second) |
385 deduped_encodings.push_back(*i); | 388 deduped_encodings.push_back(*i); |
386 } | 389 } |
387 encodings->swap(deduped_encodings); | 390 encodings->swap(deduped_encodings); |
388 return encodings->size() != deduped_encodings.size(); | 391 return encodings->size() != deduped_encodings.size(); |
389 } | 392 } |
OLD | NEW |