diff options
author | kuchhal@chromium.org <kuchhal@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-06-24 15:41:21 +0000 |
---|---|---|
committer | kuchhal@chromium.org <kuchhal@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-06-24 15:41:21 +0000 |
commit | 67dc31d0939c071af8f583d4810c623d52b24364 (patch) | |
tree | 474246f6b14a54ca449776d4b006d14cf04d4051 /chrome/browser/importer/firefox3_importer.cc | |
parent | 6087c0dedfc6909bdd224dca1fc27ecbb3d85f9e (diff) | |
download | chromium_src-67dc31d0939c071af8f583d4810c623d52b24364.zip chromium_src-67dc31d0939c071af8f583d4810c623d52b24364.tar.gz chromium_src-67dc31d0939c071af8f583d4810c623d52b24364.tar.bz2 |
Import search engines even if they are not in sqlite3 db.
BUG=14123
Review URL: http://codereview.chromium.org/146045
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@19121 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/importer/firefox3_importer.cc')
-rw-r--r-- | chrome/browser/importer/firefox3_importer.cc | 44 |
1 files changed, 21 insertions, 23 deletions
diff --git a/chrome/browser/importer/firefox3_importer.cc b/chrome/browser/importer/firefox3_importer.cc index 2f8eb46..8e739982 100644 --- a/chrome/browser/importer/firefox3_importer.cc +++ b/chrome/browser/importer/firefox3_importer.cc @@ -340,19 +340,10 @@ void Firefox3Importer::GetSearchEnginesXMLFiles( std::wstring profile_path = source_path_; file_util::AppendToPath(&profile_path, L"searchplugins"); - // Firefox doesn't store any search engines in its sqlite database unless - // the user has changed the standard set of engines. If we find that the - // database is empty, get the standard Firefox set from the app folder. - if (s.step() != SQLITE_ROW) { - file_util::FileEnumerator engines(FilePath::FromWStringHack(app_path), - false, - file_util::FileEnumerator::FILES); - for (FilePath engine_path = engines.Next(); !engine_path.value().empty(); - engine_path = engines.Next()) { - std::wstring enginew = engine_path.ToWStringHack(); - files->push_back(enginew); - } - } else { + // Firefox doesn't store a search engine in its sqlite database unless + // the user has changed the default definition of engine. So we get search + // engines from sqlite db as well as from file system. + if (s.step() == SQLITE_ROW) { const std::wstring kAppPrefix = L"[app]/"; const std::wstring kProfilePrefix = L"[profile]/"; do { @@ -366,23 +357,30 @@ void Firefox3Importer::GetSearchEnginesXMLFiles( if (index != std::wstring::npos) { // Remove '[app]/'. file = app_path; - file_util::AppendToPath( - &file, - engine.substr(index + kAppPrefix.length())); - } else if ((index = engine.find(kProfilePrefix)) != - std::wstring::npos) { + file_util::AppendToPath(&file, + engine.substr(index + kAppPrefix.length())); + } else if ((index = engine.find(kProfilePrefix)) != std::wstring::npos) { // Remove '[profile]/'. file = profile_path; - file_util::AppendToPath( - &file, - engine.substr(index + kProfilePrefix.length())); + file_util::AppendToPath(&file, + engine.substr(index + kProfilePrefix.length())); } else { - NOTREACHED() << "Unexpected Firefox 3 search engine id"; - continue; + // Looks like absolute path to the file. + file = engine; } files->push_back(file); } while (s.step() == SQLITE_ROW && !cancelled()); } + + // Get search engine definition from file system. + file_util::FileEnumerator engines(FilePath::FromWStringHack(app_path), + false, + file_util::FileEnumerator::FILES); + for (FilePath engine_path = engines.Next(); !engine_path.value().empty(); + engine_path = engines.Next()) { + std::wstring enginew = engine_path.ToWStringHack(); + files->push_back(enginew); + } } void Firefox3Importer::LoadRootNodeID(sqlite3* db, |