| 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 <map> | 7 #include <map> |
| 8 #include <set> | 8 #include <set> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 DCHECK(prepopulated_urls); | 195 DCHECK(prepopulated_urls); |
| 196 DCHECK(template_urls); | 196 DCHECK(template_urls); |
| 197 | 197 |
| 198 ActionsFromPrepopulateData actions(CreateActionsFromCurrentPrepopulateData( | 198 ActionsFromPrepopulateData actions(CreateActionsFromCurrentPrepopulateData( |
| 199 prepopulated_urls, *template_urls, default_search_provider)); | 199 prepopulated_urls, *template_urls, default_search_provider)); |
| 200 | 200 |
| 201 // Remove items. | 201 // Remove items. |
| 202 for (std::vector<TemplateURL*>::iterator i = actions.removed_engines.begin(); | 202 for (std::vector<TemplateURL*>::iterator i = actions.removed_engines.begin(); |
| 203 i < actions.removed_engines.end(); ++i) { | 203 i < actions.removed_engines.end(); ++i) { |
| 204 scoped_ptr<TemplateURL> template_url(*i); | 204 scoped_ptr<TemplateURL> template_url(*i); |
| 205 TemplateURLService::TemplateURLVector::iterator j = | 205 TemplateURLService::TemplateURLVector::iterator j = std::find( |
| 206 std::find(template_urls->begin(), template_urls->end(), template_url); | 206 template_urls->begin(), template_urls->end(), template_url.get()); |
| 207 DCHECK(j != template_urls->end()); | 207 DCHECK(j != template_urls->end()); |
| 208 DCHECK(!default_search_provider || | 208 DCHECK(!default_search_provider || |
| 209 (*j)->prepopulate_id() != default_search_provider->prepopulate_id()); | 209 (*j)->prepopulate_id() != default_search_provider->prepopulate_id()); |
| 210 template_urls->erase(j); | 210 template_urls->erase(j); |
| 211 if (service) { | 211 if (service) { |
| 212 service->RemoveKeyword(template_url->id()); | 212 service->RemoveKeyword(template_url->id()); |
| 213 if (removed_keyword_guids) | 213 if (removed_keyword_guids) |
| 214 removed_keyword_guids->insert(template_url->sync_guid()); | 214 removed_keyword_guids->insert(template_url->sync_guid()); |
| 215 } | 215 } |
| 216 } | 216 } |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 380 std::vector<std::string> deduped_encodings; | 380 std::vector<std::string> deduped_encodings; |
| 381 std::set<std::string> encoding_set; | 381 std::set<std::string> encoding_set; |
| 382 for (std::vector<std::string>::const_iterator i(encodings->begin()); | 382 for (std::vector<std::string>::const_iterator i(encodings->begin()); |
| 383 i != encodings->end(); ++i) { | 383 i != encodings->end(); ++i) { |
| 384 if (encoding_set.insert(*i).second) | 384 if (encoding_set.insert(*i).second) |
| 385 deduped_encodings.push_back(*i); | 385 deduped_encodings.push_back(*i); |
| 386 } | 386 } |
| 387 encodings->swap(deduped_encodings); | 387 encodings->swap(deduped_encodings); |
| 388 return encodings->size() != deduped_encodings.size(); | 388 return encodings->size() != deduped_encodings.size(); |
| 389 } | 389 } |
| OLD | NEW |