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

Side by Side Diff: chrome/browser/autofill/autofill_ie_toolbar_import_win.cc

Issue 11421047: sync: Move data_encryption_win.h into syncer namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix unittests Created 8 years 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
« no previous file with comments | « no previous file | chrome/browser/autofill/autofill_ie_toolbar_import_win_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/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
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
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 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/autofill/autofill_ie_toolbar_import_win_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698