| OLD | NEW |
| 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 184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 // belong to. | 195 // belong to. |
| 196 url = GURL(lines[begin]); | 196 url = GURL(lines[begin]); |
| 197 } | 197 } |
| 198 // Skips this block if the URL is not valid. | 198 // Skips this block if the URL is not valid. |
| 199 if (!url.is_valid()) | 199 if (!url.is_valid()) |
| 200 continue; | 200 continue; |
| 201 form.origin = url.ReplaceComponents(rep); | 201 form.origin = url.ReplaceComponents(rep); |
| 202 form.signon_realm = form.origin.GetOrigin().spec(); | 202 form.signon_realm = form.origin.GetOrigin().spec(); |
| 203 if (!realm.empty()) | 203 if (!realm.empty()) |
| 204 form.signon_realm += realm; | 204 form.signon_realm += realm; |
| 205 form.ssl_valid = form.origin.SchemeIsSecure(); | 205 form.ssl_valid = form.origin.SchemeUsesTLS(); |
| 206 ++begin; | 206 ++begin; |
| 207 | 207 |
| 208 // There may be multiple username/password pairs for this site. | 208 // There may be multiple username/password pairs for this site. |
| 209 // In this case, they are saved in one block without a seperated | 209 // In this case, they are saved in one block without a seperated |
| 210 // line (contains a dot). | 210 // line (contains a dot). |
| 211 while (begin + 4 < end) { | 211 while (begin + 4 < end) { |
| 212 // The user name. | 212 // The user name. |
| 213 form.username_element = base::UTF8ToUTF16(lines[begin++]); | 213 form.username_element = base::UTF8ToUTF16(lines[begin++]); |
| 214 form.username_value = Decrypt(lines[begin++]); | 214 form.username_value = Decrypt(lines[begin++]); |
| 215 // The element name has a leading '*'. | 215 // The element name has a leading '*'. |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 289 autofill::PasswordForm form; | 289 autofill::PasswordForm form; |
| 290 form.origin = url.ReplaceComponents(rep); | 290 form.origin = url.ReplaceComponents(rep); |
| 291 form.signon_realm = form.origin.GetOrigin().spec(); | 291 form.signon_realm = form.origin.GetOrigin().spec(); |
| 292 if (!realm.empty()) { | 292 if (!realm.empty()) { |
| 293 form.signon_realm += realm; | 293 form.signon_realm += realm; |
| 294 // Non-empty realm indicates that it's not html form authentication entry. | 294 // Non-empty realm indicates that it's not html form authentication entry. |
| 295 // Extracted data doesn't allow us to distinguish basic_auth entry from | 295 // Extracted data doesn't allow us to distinguish basic_auth entry from |
| 296 // digest_auth entry, so let's assume basic_auth. | 296 // digest_auth entry, so let's assume basic_auth. |
| 297 form.scheme = autofill::PasswordForm::SCHEME_BASIC; | 297 form.scheme = autofill::PasswordForm::SCHEME_BASIC; |
| 298 } | 298 } |
| 299 form.ssl_valid = form.origin.SchemeIsSecure(); | 299 form.ssl_valid = form.origin.SchemeUsesTLS(); |
| 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 } |
| OLD | NEW |