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 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 base::TrimWhitespace(value, base::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 = base::LowerCaseEqualsASCII(value, "true"); |
110 if (is_value_true || LowerCaseEqualsASCII(value, "false")) { | 110 if (is_value_true || base::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] == '"') { |
118 value = value.substr(1, value.size() - 2); | 118 value = value.substr(1, value.size() - 2); |
119 // ValueString only accept valid UTF-8. Simply ignore that entry if it is | 119 // ValueString only accept valid UTF-8. Simply ignore that entry if it is |
120 // not UTF-8. | 120 // not UTF-8. |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
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 base::TrimWhitespaceASCII(token, base::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 |