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/files/file_path.h" | 7 #include "base/files/file_path.h" |
8 #include "base/files/file_util.h" | 8 #include "base/files/file_util.h" |
9 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
10 #include "base/strings/string_split.h" | 10 #include "base/strings/string_split.h" |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 continue; | 95 continue; |
96 } | 96 } |
97 size_t stop_value = line.find(");", start_value + 1); | 97 size_t stop_value = line.find(");", start_value + 1); |
98 if (stop_value == std::string::npos) { | 98 if (stop_value == std::string::npos) { |
99 LOG(ERROR) << "Invalid value found in Firefox pref file '" << | 99 LOG(ERROR) << "Invalid value found in Firefox pref file '" << |
100 pref_file.value() << "' line is '" << line << "'."; | 100 pref_file.value() << "' line is '" << line << "'."; |
101 continue; | 101 continue; |
102 } | 102 } |
103 std::string value = line.substr(start_value + 1, | 103 std::string value = line.substr(start_value + 1, |
104 stop_value - start_value - 1); | 104 stop_value - start_value - 1); |
105 base::TrimWhitespace(value, base::TRIM_ALL, &value); | 105 base::TrimWhitespaceASCII(value, base::TRIM_ALL, &value); |
106 // Value could be a boolean. | 106 // Value could be a boolean. |
107 bool is_value_true = base::LowerCaseEqualsASCII(value, "true"); | 107 bool is_value_true = base::LowerCaseEqualsASCII(value, "true"); |
108 if (is_value_true || base::LowerCaseEqualsASCII(value, "false")) { | 108 if (is_value_true || base::LowerCaseEqualsASCII(value, "false")) { |
109 prefs->SetBoolean(key, is_value_true); | 109 prefs->SetBoolean(key, is_value_true); |
110 continue; | 110 continue; |
111 } | 111 } |
112 | 112 |
113 // Value could be a string. | 113 // Value could be a string. |
114 if (value.size() >= 2U && | 114 if (value.size() >= 2U && |
115 value[0] == '"' && value[value.size() - 1] == '"') { | 115 value[0] == '"' && value[value.size() - 1] == '"') { |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
297 while (string_tok.GetNext()) { | 297 while (string_tok.GetNext()) { |
298 std::string token = string_tok.token(); | 298 std::string token = string_tok.token(); |
299 base::TrimWhitespaceASCII(token, base::TRIM_ALL, &token); | 299 base::TrimWhitespaceASCII(token, base::TRIM_ALL, &token); |
300 if (!token.empty()) | 300 if (!token.empty()) |
301 settings->proxy_bypass_list_.push_back(token); | 301 settings->proxy_bypass_list_.push_back(token); |
302 } | 302 } |
303 } | 303 } |
304 } | 304 } |
305 return true; | 305 return true; |
306 } | 306 } |
OLD | NEW |