OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/template_url_prepopulate_data.h" | 5 #include "chrome/browser/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 |
11 #include "base/command_line.h" | 11 #include "base/command_line.h" |
(...skipping 3360 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3372 int logo_id, | 3372 int logo_id, |
3373 int id) { | 3373 int id) { |
3374 TemplateURL* new_turl = new TemplateURL(); | 3374 TemplateURL* new_turl = new TemplateURL(); |
3375 new_turl->SetURL(WideToUTF8(search_url), 0, 0); | 3375 new_turl->SetURL(WideToUTF8(search_url), 0, 0); |
3376 if (favicon_url) | 3376 if (favicon_url) |
3377 new_turl->SetFavIconURL(GURL(favicon_url)); | 3377 new_turl->SetFavIconURL(GURL(favicon_url)); |
3378 if (suggest_url) | 3378 if (suggest_url) |
3379 new_turl->SetSuggestionsURL(WideToUTF8(suggest_url), 0, 0); | 3379 new_turl->SetSuggestionsURL(WideToUTF8(suggest_url), 0, 0); |
3380 if (instant_url) | 3380 if (instant_url) |
3381 new_turl->SetInstantURL(WideToUTF8(instant_url), 0, 0); | 3381 new_turl->SetInstantURL(WideToUTF8(instant_url), 0, 0); |
3382 new_turl->set_short_name(name); | 3382 new_turl->set_short_name(WideToUTF16Hack(name)); |
3383 if (keyword == NULL) | 3383 if (keyword == NULL) |
3384 new_turl->set_autogenerate_keyword(true); | 3384 new_turl->set_autogenerate_keyword(true); |
3385 else | 3385 else |
3386 new_turl->set_keyword(keyword); | 3386 new_turl->set_keyword(WideToUTF16Hack(keyword)); |
3387 new_turl->set_show_in_default_list(true); | 3387 new_turl->set_show_in_default_list(true); |
3388 new_turl->set_safe_for_autoreplace(true); | 3388 new_turl->set_safe_for_autoreplace(true); |
3389 new_turl->set_date_created(Time()); | 3389 new_turl->set_date_created(Time()); |
3390 std::vector<std::string> turl_encodings; | 3390 std::vector<std::string> turl_encodings; |
3391 turl_encodings.push_back(encoding); | 3391 turl_encodings.push_back(encoding); |
3392 new_turl->set_input_encodings(turl_encodings); | 3392 new_turl->set_input_encodings(turl_encodings); |
3393 new_turl->set_search_engine_type(search_engine_type); | 3393 new_turl->set_search_engine_type(search_engine_type); |
3394 new_turl->set_logo_id(logo_id); | 3394 new_turl->set_logo_id(logo_id); |
3395 new_turl->set_prepopulate_id(id); | 3395 new_turl->set_prepopulate_id(id); |
3396 return new_turl; | 3396 return new_turl; |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3565 for (size_t i = 0; i < arraysize(kAllEngines); ++i) { | 3565 for (size_t i = 0; i < arraysize(kAllEngines); ++i) { |
3566 std::string url_utf8_string(ToUTF8(kAllEngines[i]->search_url)); | 3566 std::string url_utf8_string(ToUTF8(kAllEngines[i]->search_url)); |
3567 GURL url(url_utf8_string); | 3567 GURL url(url_utf8_string); |
3568 if (origin_to_find == url.GetOrigin()) | 3568 if (origin_to_find == url.GetOrigin()) |
3569 return kAllEngines[i]->logo_id; | 3569 return kAllEngines[i]->logo_id; |
3570 } | 3570 } |
3571 return kNoSearchEngineLogo; | 3571 return kNoSearchEngineLogo; |
3572 } | 3572 } |
3573 | 3573 |
3574 } // namespace TemplateURLPrepopulateData | 3574 } // namespace TemplateURLPrepopulateData |
OLD | NEW |