| 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/browser/autofill/autofill_ie_toolbar_import_win.h" | 5 #include "chrome/browser/autofill/autofill_ie_toolbar_import_win.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 #include <map> | 8 #include <map> |
| 9 #include <string> | 9 #include <string> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 DWORD data_type = REG_BINARY; | 69 DWORD data_type = REG_BINARY; |
| 70 DWORD data_size = 0; | 70 DWORD data_size = 0; |
| 71 LONG result = key->ReadValue(value_name, NULL, &data_size, &data_type); | 71 LONG result = key->ReadValue(value_name, NULL, &data_size, &data_type); |
| 72 if ((result != ERROR_SUCCESS) || !data_size || data_type != REG_BINARY) | 72 if ((result != ERROR_SUCCESS) || !data_size || data_type != REG_BINARY) |
| 73 return string16(); | 73 return string16(); |
| 74 std::vector<uint8> data; | 74 std::vector<uint8> data; |
| 75 data.resize(data_size); | 75 data.resize(data_size); |
| 76 result = key->ReadValue(value_name, &(data[0]), &data_size, &data_type); | 76 result = key->ReadValue(value_name, &(data[0]), &data_size, &data_type); |
| 77 if (result == ERROR_SUCCESS) { | 77 if (result == ERROR_SUCCESS) { |
| 78 std::string out_data; | 78 std::string out_data; |
| 79 if (DecryptData(data, &out_data)) { | 79 if (syncer::DecryptData(data, &out_data)) { |
| 80 // The actual data is in UTF16 already. | 80 // The actual data is in UTF16 already. |
| 81 if (!(out_data.size() & 1) && (out_data.size() > 2) && | 81 if (!(out_data.size() & 1) && (out_data.size() > 2) && |
| 82 !out_data[out_data.size() - 1] && !out_data[out_data.size() - 2]) { | 82 !out_data[out_data.size() - 1] && !out_data[out_data.size() - 2]) { |
| 83 return string16( | 83 return string16( |
| 84 reinterpret_cast<const wchar_t *>(out_data.c_str())); | 84 reinterpret_cast<const wchar_t *>(out_data.c_str())); |
| 85 } | 85 } |
| 86 } | 86 } |
| 87 } | 87 } |
| 88 return string16(); | 88 return string16(); |
| 89 } | 89 } |
| (...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 268 } | 268 } |
| 269 | 269 |
| 270 bool ImportAutofillDataWin(PersonalDataManager* pdm) { | 270 bool ImportAutofillDataWin(PersonalDataManager* pdm) { |
| 271 // In incognito mode we do not have PDM - and we should not import anything. | 271 // In incognito mode we do not have PDM - and we should not import anything. |
| 272 if (!pdm) | 272 if (!pdm) |
| 273 return false; | 273 return false; |
| 274 AutofillImporter *importer = new AutofillImporter(pdm); | 274 AutofillImporter *importer = new AutofillImporter(pdm); |
| 275 // importer will self delete. | 275 // importer will self delete. |
| 276 return importer->ImportProfiles(); | 276 return importer->ImportProfiles(); |
| 277 } | 277 } |
| OLD | NEW |