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

Unified Diff: chrome/browser/importer/firefox3_importer.cc

Issue 3221007: Fix a couple of firefox search engine import bugs. (Closed) Base URL: http://src.chromium.org/git/chromium.git
Patch Set: added test, TODO Created 10 years, 4 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/browser/importer/firefox3_importer.h ('k') | chrome/browser/importer/firefox_importer_utils.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/importer/firefox3_importer.cc
diff --git a/chrome/browser/importer/firefox3_importer.cc b/chrome/browser/importer/firefox3_importer.cc
index 76613b6415ecbc65d9cdbf212414c1439a7a90d0..8bbba685269f64bbf5d64deac5499360b1c95a41 100644
--- a/chrome/browser/importer/firefox3_importer.cc
+++ b/chrome/browser/importer/firefox3_importer.cc
@@ -12,6 +12,7 @@
#include "base/stl_util-inl.h"
#include "base/string_util.h"
#include "base/values.h"
+#include "chrome/browser/browser_process.h"
#include "chrome/browser/history/history_types.h"
#include "chrome/browser/importer/firefox2_importer.h"
#include "chrome/browser/importer/firefox_importer_utils.h"
@@ -34,14 +35,23 @@ using importer::ProfileInfo;
using importer::SEARCH_ENGINES;
using webkit_glue::PasswordForm;
+Firefox3Importer::Firefox3Importer() {
+ DCHECK(ChromeThread::CurrentlyOn(ChromeThread::UI));
+
+ locale_ = g_browser_process->GetApplicationLocale();
+}
+
+Firefox3Importer::~Firefox3Importer() {
+}
+
void Firefox3Importer::StartImport(importer::ProfileInfo profile_info,
uint16 items,
ImporterBridge* bridge) {
+ DCHECK(ChromeThread::CurrentlyOn(ChromeThread::FILE));
bridge_ = bridge;
source_path_ = profile_info.source_path;
app_path_ = profile_info.app_path;
-
// The order here is important!
bridge_->NotifyStarted();
if ((items & importer::HOME_PAGE) && !cancelled())
@@ -350,9 +360,9 @@ void Firefox3Importer::GetSearchEnginesXMLFiles(
FilePath app_path = app_path_.AppendASCII("searchplugins");
FilePath profile_path = source_path_.AppendASCII("searchplugins");
- // 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.
+ // 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
+ // as from the file system.
if (s.step() == SQLITE_ROW) {
const std::wstring kAppPrefix = L"[app]/";
const std::wstring kProfilePrefix = L"[profile]/";
@@ -381,6 +391,20 @@ void Firefox3Importer::GetSearchEnginesXMLFiles(
} while (s.step() == SQLITE_ROW && !cancelled());
}
+#if defined(OS_LINUX)
+ // Ubuntu-flavored Firefox3 supports locale-specific search engines via
+ // locale-named subdirectories. They fall back to en-US.
+ // See http://crbug.com/53899
+ // TODO(jshin): we need to make sure our locale code matches that of
+ // Firefox.
+ FilePath locale_app_path = app_path.AppendASCII(locale_);
+ FilePath default_locale_app_path = app_path.AppendASCII("en-US");
+ if (file_util::DirectoryExists(locale_app_path))
+ app_path = locale_app_path;
+ else if (file_util::DirectoryExists(default_locale_app_path))
+ app_path = default_locale_app_path;
+#endif
+
// Get search engine definition from file system.
file_util::FileEnumerator engines(app_path, false,
file_util::FileEnumerator::FILES);
« no previous file with comments | « chrome/browser/importer/firefox3_importer.h ('k') | chrome/browser/importer/firefox_importer_utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698