| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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/importer/nss_decryptor.h" | 5 #include "chrome/browser/importer/nss_decryptor.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/scoped_ptr.h" | 10 #include "base/scoped_ptr.h" |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 // References: | 112 // References: |
| 113 // http://kb.mozillazine.org/Signons.txt | 113 // http://kb.mozillazine.org/Signons.txt |
| 114 // http://kb.mozillazine.org/Signons2.txt | 114 // http://kb.mozillazine.org/Signons2.txt |
| 115 // http://kb.mozillazine.org/Signons3.txt | 115 // http://kb.mozillazine.org/Signons3.txt |
| 116 void NSSDecryptor::ParseSignons(const std::string& content, | 116 void NSSDecryptor::ParseSignons(const std::string& content, |
| 117 std::vector<PasswordForm>* forms) { | 117 std::vector<PasswordForm>* forms) { |
| 118 forms->clear(); | 118 forms->clear(); |
| 119 | 119 |
| 120 // Splits the file content into lines. | 120 // Splits the file content into lines. |
| 121 std::vector<std::string> lines; | 121 std::vector<std::string> lines; |
| 122 SplitString(content, '\n', &lines); | 122 base::SplitString(content, '\n', &lines); |
| 123 | 123 |
| 124 // The first line is the file version. We skip the unknown versions. | 124 // The first line is the file version. We skip the unknown versions. |
| 125 if (lines.empty()) | 125 if (lines.empty()) |
| 126 return; | 126 return; |
| 127 int version; | 127 int version; |
| 128 if (lines[0] == "#2c") | 128 if (lines[0] == "#2c") |
| 129 version = 1; | 129 version = 1; |
| 130 else if (lines[0] == "#2d") | 130 else if (lines[0] == "#2d") |
| 131 version = 2; | 131 version = 2; |
| 132 else if (lines[0] == "#2e") | 132 else if (lines[0] == "#2e") |
| (...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 293 // The user name, password and action. | 293 // The user name, password and action. |
| 294 form.username_element = UTF8ToUTF16(s2.column_string(3)); | 294 form.username_element = UTF8ToUTF16(s2.column_string(3)); |
| 295 form.username_value = Decrypt(s2.column_string(5)); | 295 form.username_value = Decrypt(s2.column_string(5)); |
| 296 form.password_element = UTF8ToUTF16(s2.column_string(4)); | 296 form.password_element = UTF8ToUTF16(s2.column_string(4)); |
| 297 form.password_value = Decrypt(s2.column_string(6)); | 297 form.password_value = Decrypt(s2.column_string(6)); |
| 298 form.action = GURL(s2.column_string(2)).ReplaceComponents(rep); | 298 form.action = GURL(s2.column_string(2)).ReplaceComponents(rep); |
| 299 forms->push_back(form); | 299 forms->push_back(form); |
| 300 } | 300 } |
| 301 return true; | 301 return true; |
| 302 } | 302 } |
| OLD | NEW |