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

Side by Side Diff: chrome/browser/net/firefox_proxy_settings.cc

Issue 196793010: Move IsStringASCII/UTF8 to base namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
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.
121 if (IsStringUTF8(value)) 121 if (base::IsStringUTF8(value))
122 prefs->SetString(key, value); 122 prefs->SetString(key, value);
123 else 123 else
124 VLOG(1) << "Non UTF8 value for key " << key << ", ignored."; 124 VLOG(1) << "Non UTF8 value for key " << key << ", ignored.";
125 continue; 125 continue;
126 } 126 }
127 127
128 // Or value could be an integer. 128 // Or value could be an integer.
129 int int_value = 0; 129 int int_value = 0;
130 if (base::StringToInt(value, &int_value)) { 130 if (base::StringToInt(value, &int_value)) {
131 prefs->SetInteger(key, int_value); 131 prefs->SetInteger(key, int_value);
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 }
OLDNEW
« no previous file with comments | « chrome/browser/invalidation/invalidator_storage_unittest.cc ('k') | chrome/browser/profile_resetter/jtl_interpreter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698