| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/net/firefox_proxy_settings.h" | 5 #include "chrome/browser/net/firefox_proxy_settings.h" |
| 6 | 6 |
| 7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
| 8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
| 9 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
| 10 #include "base/strings/string_tokenizer.h" | 10 #include "base/strings/string_tokenizer.h" |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 continue; | 97 continue; |
| 98 } | 98 } |
| 99 size_t stop_value = line.find(");", start_value + 1); | 99 size_t stop_value = line.find(");", start_value + 1); |
| 100 if (stop_value == std::string::npos) { | 100 if (stop_value == std::string::npos) { |
| 101 LOG(ERROR) << "Invalid value found in Firefox pref file '" << | 101 LOG(ERROR) << "Invalid value found in Firefox pref file '" << |
| 102 pref_file.value() << "' line is '" << line << "'."; | 102 pref_file.value() << "' line is '" << line << "'."; |
| 103 continue; | 103 continue; |
| 104 } | 104 } |
| 105 std::string value = line.substr(start_value + 1, | 105 std::string value = line.substr(start_value + 1, |
| 106 stop_value - start_value - 1); | 106 stop_value - start_value - 1); |
| 107 TrimWhitespace(value, TRIM_ALL, &value); | 107 base::TrimWhitespace(value, base::TRIM_ALL, &value); |
| 108 // Value could be a boolean. | 108 // Value could be a boolean. |
| 109 bool is_value_true = LowerCaseEqualsASCII(value, "true"); | 109 bool is_value_true = LowerCaseEqualsASCII(value, "true"); |
| 110 if (is_value_true || LowerCaseEqualsASCII(value, "false")) { | 110 if (is_value_true || LowerCaseEqualsASCII(value, "false")) { |
| 111 prefs->SetBoolean(key, is_value_true); | 111 prefs->SetBoolean(key, is_value_true); |
| 112 continue; | 112 continue; |
| 113 } | 113 } |
| 114 | 114 |
| 115 // Value could be a string. | 115 // Value could be a string. |
| 116 if (value.size() >= 2U && | 116 if (value.size() >= 2U && |
| 117 value[0] == '"' && value[value.size() - 1] == '"') { | 117 value[0] == '"' && value[value.size() - 1] == '"') { |
| (...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 291 int socks_version; | 291 int socks_version; |
| 292 if (dictionary.GetInteger(kSOCKSVersionKey, &socks_version)) | 292 if (dictionary.GetInteger(kSOCKSVersionKey, &socks_version)) |
| 293 settings->socks_version_ = IntToSOCKSVersion(socks_version); | 293 settings->socks_version_ = IntToSOCKSVersion(socks_version); |
| 294 | 294 |
| 295 std::string proxy_bypass; | 295 std::string proxy_bypass; |
| 296 if (dictionary.GetStringASCII(kNoProxyListKey, &proxy_bypass) && | 296 if (dictionary.GetStringASCII(kNoProxyListKey, &proxy_bypass) && |
| 297 !proxy_bypass.empty()) { | 297 !proxy_bypass.empty()) { |
| 298 base::StringTokenizer string_tok(proxy_bypass, ","); | 298 base::StringTokenizer string_tok(proxy_bypass, ","); |
| 299 while (string_tok.GetNext()) { | 299 while (string_tok.GetNext()) { |
| 300 std::string token = string_tok.token(); | 300 std::string token = string_tok.token(); |
| 301 TrimWhitespaceASCII(token, TRIM_ALL, &token); | 301 base::TrimWhitespaceASCII(token, base::TRIM_ALL, &token); |
| 302 if (!token.empty()) | 302 if (!token.empty()) |
| 303 settings->proxy_bypass_list_.push_back(token); | 303 settings->proxy_bypass_list_.push_back(token); |
| 304 } | 304 } |
| 305 } | 305 } |
| 306 } | 306 } |
| 307 return true; | 307 return true; |
| 308 } | 308 } |
| OLD | NEW |