| 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 "chrome/browser/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> |
| 11 | 11 |
| 12 #include "base/logging.h" | 12 #include "base/logging.h" |
| 13 #include "base/memory/scoped_vector.h" | 13 #include "base/memory/scoped_vector.h" |
| 14 #include "base/prefs/pref_service.h" | 14 #include "base/prefs/pref_service.h" |
| 15 #include "base/time/time.h" | 15 #include "base/time/time.h" |
| 16 #include "chrome/browser/search_engines/template_url_service.h" | |
| 17 #include "components/search_engines/template_url.h" | 16 #include "components/search_engines/template_url.h" |
| 18 #include "components/search_engines/template_url_prepopulate_data.h" | 17 #include "components/search_engines/template_url_prepopulate_data.h" |
| 18 #include "components/search_engines/template_url_service.h" |
| 19 | 19 |
| 20 base::string16 GetDefaultSearchEngineName(TemplateURLService* service) { | 20 base::string16 GetDefaultSearchEngineName(TemplateURLService* service) { |
| 21 DCHECK(service); | 21 DCHECK(service); |
| 22 const TemplateURL* const default_provider = | 22 const TemplateURL* const default_provider = |
| 23 service->GetDefaultSearchProvider(); | 23 service->GetDefaultSearchProvider(); |
| 24 if (!default_provider) { | 24 if (!default_provider) { |
| 25 // TODO(cpu): bug 1187517. It is possible to have no default provider. | 25 // TODO(cpu): bug 1187517. It is possible to have no default provider. |
| 26 // returning an empty string is a stopgap measure for the crash | 26 // returning an empty string is a stopgap measure for the crash |
| 27 // http://code.google.com/p/chromium/issues/detail?id=2573 | 27 // http://code.google.com/p/chromium/issues/detail?id=2573 |
| 28 return base::string16(); | 28 return base::string16(); |
| (...skipping 351 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 |