Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(36)

Unified Diff: chrome/browser/search_engines/template_url_prepopulate_data.cc

Issue 11377049: Moving prepopulated search engines to a JSON file. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 8 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/browser/search_engines/template_url_prepopulate_data.cc
diff --git a/chrome/browser/search_engines/template_url_prepopulate_data.cc b/chrome/browser/search_engines/template_url_prepopulate_data.cc
index a3e93e13954ebab8a94291739b9accd643bc0f92..fd2d0743c30ac9c3231730f8e8a369e4f7d8921c 100644
--- a/chrome/browser/search_engines/template_url_prepopulate_data.cc
+++ b/chrome/browser/search_engines/template_url_prepopulate_data.cc
@@ -32,6 +32,10 @@
#include "grit/theme_resources.h"
#include "ui/base/l10n/l10n_util.h"
+#include "prepopulated_engines.h"
+
+using namespace search_engines;
Peter Kasting 2012/11/08 19:02:25 This is banned by the style guide
beaudoin 2012/11/08 19:39:01 I didn't like it either. Other options I can think
beaudoin 2012/11/09 04:16:53 Found an elegant fix by using the same namespace f
+
#if defined(OS_WIN)
#undef IN // On Windows, windef.h defines this, which screws up "India" cases.
#elif defined(OS_MACOSX)
@@ -43,82 +47,11 @@ namespace {
// NOTE: See comments in GetDataVersion() below! You should probably not change
// the data in this file without changing the result of that function!
-// Engine definitions //////////////////////////////////////////////////////////
-
-struct PrepopulatedEngine {
- const wchar_t* const name;
- const wchar_t* const keyword;
- const char* const favicon_url; // If NULL, there is no favicon.
- const char* const search_url;
- const char* const encoding;
- const char* const suggest_url; // If NULL, this engine does not support
- // suggestions.
- const char* const instant_url; // If NULL, this engine does not support
- // instant.
- // A JSON array containing a list of URL patterns that can be used, in
- // addition to |search_url|, to extract search terms from a URL. Can be NULL.
- const char* const alternate_urls;
- // SEARCH_ENGINE_OTHER if there is no matching type.
- const SearchEngineType type;
- // Unique id for this prepopulate engine (corresponds to
- // TemplateURL::prepopulate_id). This ID must be greater than zero and must
- // remain the same for a particular site regardless of how the url changes;
- // the ID is used when modifying engine data in subsequent versions, so that
- // we can find the "old" entry to update even when the name or URL changes.
- //
- // This ID must be "unique" within one country's prepopulated data, but two
- // entries can share an ID if they represent the "same" engine (e.g. Yahoo! US
- // vs. Yahoo! UK) and will not appear in the same user-visible data set. This
- // facilitates changes like adding more specific per-country data in the
- // future; in such a case the localized engines will transparently replace the
- // previous, non-localized versions. For engines where we need two instances
- // to appear for one country (e.g. Bing Search U.S. English and Spanish), we
- // must use two different unique IDs (and different keywords).
- //
- // The following unique IDs are available:
- // 53, 56, 58, 60, 61, 64, 65, 66, 70, 74, 78, 79, 80, 81, 84, 86, 88, 91,
- // 92, 93, 94, 95, 96, 97, 98, 99, 102+
- //
- // IDs > 1000 are reserved for distribution custom engines.
- //
- // NOTES:
- // CHANGE THE ABOVE NUMBERS IF YOU ADD A NEW ENGINE; ID conflicts = bad!
- // CHANGE kMaxPrepopulatedEngineID below if you add new engine outside
- // of the current range or it will not be counted in stats.
- const int id;
-};
-
// Prepopulated engines ////////////////////////////////////////////////////////
// The following engines are included in country lists and are added to the list
// of search engines on the first run depending on user's country.
-const PrepopulatedEngine abcsok = {
- L"ABC S\x00f8k",
- L"abcsok.no",
- "http://abcsok.no/favicon.ico",
- "http://abcsok.no/index.html?q={searchTerms}",
- "UTF-8",
- NULL,
- NULL,
- NULL,
- SEARCH_ENGINE_ABCSOK,
- 72,
-};
-
-const PrepopulatedEngine altavista = {
- L"AltaVista",
- L"altavista.com",
- "http://www.altavista.com/favicon.ico",
- "http://www.altavista.com/web/results?q={searchTerms}",
- "UTF-8",
- NULL,
- NULL,
- NULL,
- SEARCH_ENGINE_ALTAVISTA,
- 89,
-};
-
const PrepopulatedEngine altavista_ar = {
L"AltaVista",
L"ar.altavista.com",

Powered by Google App Engine
This is Rietveld 408576698