| 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/template_url_prepopulate_data.h" | 5 #include "components/search_engines/template_url_prepopulate_data.h" |
| 6 | 6 |
| 7 #if defined(OS_POSIX) && !defined(OS_MACOSX) | 7 #if defined(OS_POSIX) && !defined(OS_MACOSX) |
| 8 #include <locale.h> | 8 #include <locale.h> |
| 9 #endif | 9 #endif |
| 10 | 10 |
| (...skipping 1082 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1093 return t_urls.Pass(); | 1093 return t_urls.Pass(); |
| 1094 | 1094 |
| 1095 size_t num_engines = list->GetSize(); | 1095 size_t num_engines = list->GetSize(); |
| 1096 for (size_t i = 0; i != num_engines; ++i) { | 1096 for (size_t i = 0; i != num_engines; ++i) { |
| 1097 const base::DictionaryValue* engine; | 1097 const base::DictionaryValue* engine; |
| 1098 base::string16 name; | 1098 base::string16 name; |
| 1099 base::string16 keyword; | 1099 base::string16 keyword; |
| 1100 std::string search_url; | 1100 std::string search_url; |
| 1101 std::string favicon_url; | 1101 std::string favicon_url; |
| 1102 std::string encoding; | 1102 std::string encoding; |
| 1103 int id; | 1103 int id = -1; |
| 1104 // The following fields are required for each search engine configuration. | 1104 // The following fields are required for each search engine configuration. |
| 1105 if (list->GetDictionary(i, &engine) && | 1105 if (list->GetDictionary(i, &engine) && |
| 1106 engine->GetString("name", &name) && !name.empty() && | 1106 engine->GetString("name", &name) && !name.empty() && |
| 1107 engine->GetString("keyword", &keyword) && !keyword.empty() && | 1107 engine->GetString("keyword", &keyword) && !keyword.empty() && |
| 1108 engine->GetString("search_url", &search_url) && !search_url.empty() && | 1108 engine->GetString("search_url", &search_url) && !search_url.empty() && |
| 1109 engine->GetString("favicon_url", &favicon_url) && | 1109 engine->GetString("favicon_url", &favicon_url) && |
| 1110 !favicon_url.empty() && | 1110 !favicon_url.empty() && |
| 1111 engine->GetString("encoding", &encoding) && !encoding.empty() && | 1111 engine->GetString("encoding", &encoding) && !encoding.empty() && |
| 1112 engine->GetInteger("id", &id)) { | 1112 engine->GetInteger("id", &id)) { |
| 1113 // These fields are optional. | 1113 // These fields are optional. |
| (...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1293 for (size_t j = 0; j < kAllEngines[i]->alternate_urls_size; ++j) { | 1293 for (size_t j = 0; j < kAllEngines[i]->alternate_urls_size; ++j) { |
| 1294 if (SameDomain(url, GURL(kAllEngines[i]->alternate_urls[j]))) | 1294 if (SameDomain(url, GURL(kAllEngines[i]->alternate_urls[j]))) |
| 1295 return kAllEngines[i]->type; | 1295 return kAllEngines[i]->type; |
| 1296 } | 1296 } |
| 1297 } | 1297 } |
| 1298 | 1298 |
| 1299 return SEARCH_ENGINE_OTHER; | 1299 return SEARCH_ENGINE_OTHER; |
| 1300 } | 1300 } |
| 1301 | 1301 |
| 1302 } // namespace TemplateURLPrepopulateData | 1302 } // namespace TemplateURLPrepopulateData |
| OLD | NEW |