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

Side by Side Diff: chrome/utility/importer/nss_decryptor.cc

Issue 1240183002: Update SplitString calls in chrome. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 5 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
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/utility/importer/nss_decryptor.h" 5 #include "chrome/utility/importer/nss_decryptor.h"
6 6
7 #include <string> 7 #include <string>
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/base64.h" 10 #include "base/base64.h"
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 // References: 114 // References:
115 // http://kb.mozillazine.org/Signons.txt 115 // http://kb.mozillazine.org/Signons.txt
116 // http://kb.mozillazine.org/Signons2.txt 116 // http://kb.mozillazine.org/Signons2.txt
117 // http://kb.mozillazine.org/Signons3.txt 117 // http://kb.mozillazine.org/Signons3.txt
118 void NSSDecryptor::ParseSignons( 118 void NSSDecryptor::ParseSignons(
119 const std::string& content, 119 const std::string& content,
120 std::vector<autofill::PasswordForm>* forms) { 120 std::vector<autofill::PasswordForm>* forms) {
121 forms->clear(); 121 forms->clear();
122 122
123 // Splits the file content into lines. 123 // Splits the file content into lines.
124 std::vector<std::string> lines; 124 std::vector<std::string> lines = base::SplitString(
125 base::SplitString(content, '\n', &lines); 125 content, "\n", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL);
126 126
127 // The first line is the file version. We skip the unknown versions. 127 // The first line is the file version. We skip the unknown versions.
128 if (lines.empty()) 128 if (lines.empty())
129 return; 129 return;
130 int version; 130 int version;
131 if (lines[0] == "#2c") 131 if (lines[0] == "#2c")
132 version = 1; 132 version = 1;
133 else if (lines[0] == "#2d") 133 else if (lines[0] == "#2d")
134 version = 2; 134 version = 2;
135 else if (lines[0] == "#2e") 135 else if (lines[0] == "#2e")
(...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after
300 // The user name, password and action. 300 // The user name, password and action.
301 form.username_element = s2.ColumnString16(3); 301 form.username_element = s2.ColumnString16(3);
302 form.username_value = Decrypt(s2.ColumnString(5)); 302 form.username_value = Decrypt(s2.ColumnString(5));
303 form.password_element = s2.ColumnString16(4); 303 form.password_element = s2.ColumnString16(4);
304 form.password_value = Decrypt(s2.ColumnString(6)); 304 form.password_value = Decrypt(s2.ColumnString(6));
305 form.action = GURL(s2.ColumnString(2)).ReplaceComponents(rep); 305 form.action = GURL(s2.ColumnString(2)).ReplaceComponents(rep);
306 forms->push_back(form); 306 forms->push_back(form);
307 } 307 }
308 return true; 308 return true;
309 } 309 }
OLDNEW
« no previous file with comments | « chrome/utility/importer/ie_importer_win.cc ('k') | chrome/utility/media_galleries/picasa_albums_indexer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698