summaryrefslogtreecommitdiffstats
path: root/chrome/common/importer
diff options
context:
space:
mode:
authortfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-07-23 15:57:25 +0000
committertfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-07-23 15:57:25 +0000
commitc8ead276cb15ca0707bb2826fbfe386952bfe297 (patch)
tree62b521525475cd8913f48faaa6fdbf266e1cef8a /chrome/common/importer
parentf15e5812aa7b6d4025edb8181a1d9d3e8e82c5fb (diff)
downloadchromium_src-c8ead276cb15ca0707bb2826fbfe386952bfe297.zip
chromium_src-c8ead276cb15ca0707bb2826fbfe386952bfe297.tar.gz
chromium_src-c8ead276cb15ca0707bb2826fbfe386952bfe297.tar.bz2
Reland "Move firefox_proxy_settings* out of importer."
Apparently FirefoxProxySettings has nothing to do with importer/, it's use only by c/b/net. So per request we move it there. This relands the commit at revision r212579. It was reverted because it broke Android build given that it before it was being excluded but after not. This fixes this issue, excluding the build of those files from Android build again. BUG=258876 TEST=unit_tests R=gab@chromium.org,eroman@chromium.org,yfriedman@chromium.org Review URL: https://chromiumcodereview.appspot.com/19905003 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@213132 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common/importer')
-rw-r--r--chrome/common/importer/firefox_importer_utils.cc72
-rw-r--r--chrome/common/importer/firefox_importer_utils.h9
2 files changed, 0 insertions, 81 deletions
diff --git a/chrome/common/importer/firefox_importer_utils.cc b/chrome/common/importer/firefox_importer_utils.cc
index d6ec2d3..5ec56d6 100644
--- a/chrome/common/importer/firefox_importer_utils.cc
+++ b/chrome/common/importer/firefox_importer_utils.cc
@@ -226,78 +226,6 @@ bool IsDefaultHomepage(const GURL& homepage, const base::FilePath& app_path) {
return false;
}
-bool ParsePrefFile(const base::FilePath& pref_file, DictionaryValue* prefs) {
- // The string that is before a pref key.
- const std::string kUserPrefString = "user_pref(\"";
- std::string contents;
- if (!file_util::ReadFileToString(pref_file, &contents))
- return false;
-
- std::vector<std::string> lines;
- Tokenize(contents, "\n", &lines);
-
- for (std::vector<std::string>::const_iterator iter = lines.begin();
- iter != lines.end(); ++iter) {
- const std::string& line = *iter;
- size_t start_key = line.find(kUserPrefString);
- if (start_key == std::string::npos)
- continue; // Could be a comment or a blank line.
- start_key += kUserPrefString.length();
- size_t stop_key = line.find('"', start_key);
- if (stop_key == std::string::npos) {
- LOG(ERROR) << "Invalid key found in Firefox pref file '" <<
- pref_file.value() << "' line is '" << line << "'.";
- continue;
- }
- std::string key = line.substr(start_key, stop_key - start_key);
- size_t start_value = line.find(',', stop_key + 1);
- if (start_value == std::string::npos) {
- LOG(ERROR) << "Invalid value found in Firefox pref file '" <<
- pref_file.value() << "' line is '" << line << "'.";
- continue;
- }
- size_t stop_value = line.find(");", start_value + 1);
- if (stop_value == std::string::npos) {
- LOG(ERROR) << "Invalid value found in Firefox pref file '" <<
- pref_file.value() << "' line is '" << line << "'.";
- continue;
- }
- std::string value = line.substr(start_value + 1,
- stop_value - start_value - 1);
- TrimWhitespace(value, TRIM_ALL, &value);
- // Value could be a boolean.
- bool is_value_true = LowerCaseEqualsASCII(value, "true");
- if (is_value_true || LowerCaseEqualsASCII(value, "false")) {
- prefs->SetBoolean(key, is_value_true);
- continue;
- }
-
- // Value could be a string.
- if (value.size() >= 2U &&
- value[0] == '"' && value[value.size() - 1] == '"') {
- value = value.substr(1, value.size() - 2);
- // ValueString only accept valid UTF-8. Simply ignore that entry if it is
- // not UTF-8.
- if (IsStringUTF8(value))
- prefs->SetString(key, value);
- else
- VLOG(1) << "Non UTF8 value for key " << key << ", ignored.";
- continue;
- }
-
- // Or value could be an integer.
- int int_value = 0;
- if (base::StringToInt(value, &int_value)) {
- prefs->SetInteger(key, int_value);
- continue;
- }
-
- LOG(ERROR) << "Invalid value found in Firefox pref file '"
- << pref_file.value() << "' value is '" << value << "'.";
- }
- return true;
-}
-
std::string GetPrefsJsValue(const std::string& content,
const std::string& pref_key) {
// This file has the syntax: user_pref("key", value);
diff --git a/chrome/common/importer/firefox_importer_utils.h b/chrome/common/importer/firefox_importer_utils.h
index 09da571..54c5a74 100644
--- a/chrome/common/importer/firefox_importer_utils.h
+++ b/chrome/common/importer/firefox_importer_utils.h
@@ -84,15 +84,6 @@ GURL GetHomepage(const base::FilePath& profile_path);
// directory.
bool IsDefaultHomepage(const GURL& homepage, const base::FilePath& app_path);
-// Parses the prefs found in the file |pref_file| and puts the key/value pairs
-// in |prefs|. Keys are strings, and values can be strings, booleans or
-// integers. Returns true if it succeeded, false otherwise (in which case
-// |prefs| is not filled).
-// Note: for strings, only valid UTF-8 string values are supported. If a
-// key/pair is not valid UTF-8, it is ignored and will not appear in |prefs|.
-bool ParsePrefFile(const base::FilePath& pref_file,
- base::DictionaryValue* prefs);
-
// Parses the value of a particular firefox preference from a string that is the
// contents of the prefs file.
std::string GetPrefsJsValue(const std::string& prefs,