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

Unified Diff: chrome/utility/importer/firefox_importer.cc

Issue 117123002: Fixing Firefox 21+ password import (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Revert enabling browser tests on Mac Created 6 years, 11 months 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
« no previous file with comments | « chrome/common/importer/firefox_importer_utils.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/utility/importer/firefox_importer.cc
diff --git a/chrome/utility/importer/firefox_importer.cc b/chrome/utility/importer/firefox_importer.cc
index ab7d2966ec605cc90cc5aa594bd556413dc1731a..711b7728528012ac115a86eca6b3abe73213ccbf 100644
--- a/chrome/utility/importer/firefox_importer.cc
+++ b/chrome/utility/importer/firefox_importer.cc
@@ -383,6 +383,9 @@ void FirefoxImporter::ImportHomepage() {
void FirefoxImporter::GetSearchEnginesXMLData(
std::vector<std::string>* search_engine_data) {
+ // TODO(mpawlowski): This may no longer work, search engines are stored in
+ // search.json since Firefox 3.5, not in search.sqlite. XML definitions are
+ // still necessary. http://crbug.com/329175
base::FilePath file = source_path_.AppendASCII("search.sqlite");
if (!base::PathExists(file))
return;
@@ -401,8 +404,21 @@ void FirefoxImporter::GetSearchEnginesXMLData(
if (!s.is_valid())
return;
- base::FilePath app_path = app_path_.AppendASCII("searchplugins");
- base::FilePath profile_path = source_path_.AppendASCII("searchplugins");
+ const base::FilePath searchplugins_path(FILE_PATH_LITERAL("searchplugins"));
+ // Search engine definitions are XMLs stored in two directories. Default
+ // engines are in the app directory (app_path_) and custom engines are
+ // in the profile directory (source_path_).
+
+ // Since Firefox 21, app_path_ engines are in 'browser' subdirectory:
+ base::FilePath app_path =
+ app_path_.AppendASCII("browser").Append(searchplugins_path);
+ if (!base::PathExists(app_path)) {
+ // This might be an older Firefox, try old location without the 'browser'
+ // path component:
+ app_path = app_path_.Append(searchplugins_path);
+ }
+
+ base::FilePath profile_path = source_path_.Append(searchplugins_path);
// Firefox doesn't store a search engine in its sqlite database unless the
// user has added a engine. So we get search engines from sqlite db as well
« no previous file with comments | « chrome/common/importer/firefox_importer_utils.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698