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

Side by Side Diff: chrome/utility/importer/nss_decryptor_mac.h

Issue 23742004: Move PasswordForm from //content to //autofill. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@move_password_form_conversion_utils
Patch Set: Rebase Created 7 years, 3 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
« no previous file with comments | « chrome/utility/importer/nss_decryptor.cc ('k') | chrome/utility/importer/nss_decryptor_null.h » ('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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 #ifndef CHROME_UTILITY_IMPORTER_NSS_DECRYPTOR_MAC_H_ 5 #ifndef CHROME_UTILITY_IMPORTER_NSS_DECRYPTOR_MAC_H_
6 #define CHROME_UTILITY_IMPORTER_NSS_DECRYPTOR_MAC_H_ 6 #define CHROME_UTILITY_IMPORTER_NSS_DECRYPTOR_MAC_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 typedef void (*PK11FreeSlotFunc)(PK11SlotInfo *slot); 100 typedef void (*PK11FreeSlotFunc)(PK11SlotInfo *slot);
101 typedef SECStatus (*PK11CheckUserPasswordFunc)(PK11SlotInfo *slot, char *pw); 101 typedef SECStatus (*PK11CheckUserPasswordFunc)(PK11SlotInfo *slot, char *pw);
102 typedef SECStatus 102 typedef SECStatus
103 (*PK11AuthenticateFunc)(PK11SlotInfo *slot, PRBool loadCerts, void *wincx); 103 (*PK11AuthenticateFunc)(PK11SlotInfo *slot, PRBool loadCerts, void *wincx);
104 typedef SECStatus 104 typedef SECStatus
105 (*PK11SDRDecryptFunc)(SECItem *data, SECItem *result, void *cx); 105 (*PK11SDRDecryptFunc)(SECItem *data, SECItem *result, void *cx);
106 typedef void (*SECITEMFreeItemFunc)(SECItem *item, PRBool free_it); 106 typedef void (*SECITEMFreeItemFunc)(SECItem *item, PRBool free_it);
107 typedef void (*PLArenaFinishFunc)(void); 107 typedef void (*PLArenaFinishFunc)(void);
108 typedef PRStatus (*PRCleanupFunc)(void); 108 typedef PRStatus (*PRCleanupFunc)(void);
109 109
110 namespace content { 110 namespace autofill {
111 struct PasswordForm; 111 struct PasswordForm;
112 } 112 }
113 113
114 // A wrapper for Firefox NSS decrypt component. 114 // A wrapper for Firefox NSS decrypt component.
115 class NSSDecryptor { 115 class NSSDecryptor {
116 public: 116 public:
117 NSSDecryptor() 117 NSSDecryptor()
118 : NSS_Init(NULL), NSS_Shutdown(NULL), PK11_GetInternalKeySlot(NULL), 118 : NSS_Init(NULL), NSS_Shutdown(NULL), PK11_GetInternalKeySlot(NULL),
119 PK11_CheckUserPassword(NULL), PK11_FreeSlot(NULL), 119 PK11_CheckUserPassword(NULL), PK11_FreeSlot(NULL),
120 PK11_Authenticate(NULL), PK11SDR_Decrypt(NULL), SECITEM_FreeItem(NULL), 120 PK11_Authenticate(NULL), PK11SDR_Decrypt(NULL), SECITEM_FreeItem(NULL),
121 is_nss_initialized_(false) {} 121 is_nss_initialized_(false) {}
122 ~NSSDecryptor(); 122 ~NSSDecryptor();
123 123
124 // Initializes NSS if it hasn't already been initialized. 124 // Initializes NSS if it hasn't already been initialized.
125 bool Init(const base::FilePath& dll_path, const base::FilePath& db_path); 125 bool Init(const base::FilePath& dll_path, const base::FilePath& db_path);
126 126
127 // Decrypts Firefox stored passwords. Before using this method, 127 // Decrypts Firefox stored passwords. Before using this method,
128 // make sure Init() returns true. 128 // make sure Init() returns true.
129 string16 Decrypt(const std::string& crypt) const; 129 string16 Decrypt(const std::string& crypt) const;
130 130
131 // Parses the Firefox password file content, decrypts the 131 // Parses the Firefox password file content, decrypts the
132 // username/password and reads other related information. 132 // username/password and reads other related information.
133 // The result will be stored in |forms|. 133 // The result will be stored in |forms|.
134 void ParseSignons(const std::string& content, 134 void ParseSignons(const std::string& content,
135 std::vector<content::PasswordForm>* forms); 135 std::vector<autofill::PasswordForm>* forms);
136 136
137 // Reads and parses the Firefox password sqlite db, decrypts the 137 // Reads and parses the Firefox password sqlite db, decrypts the
138 // username/password and reads other related information. 138 // username/password and reads other related information.
139 // The result will be stored in |forms|. 139 // The result will be stored in |forms|.
140 bool ReadAndParseSignons(const base::FilePath& sqlite_file, 140 bool ReadAndParseSignons(const base::FilePath& sqlite_file,
141 std::vector<content::PasswordForm>* forms); 141 std::vector<autofill::PasswordForm>* forms);
142 private: 142 private:
143 PK11SlotInfo* GetKeySlotForDB() const { return PK11_GetInternalKeySlot(); } 143 PK11SlotInfo* GetKeySlotForDB() const { return PK11_GetInternalKeySlot(); }
144 void FreeSlot(PK11SlotInfo* slot) const { PK11_FreeSlot(slot); } 144 void FreeSlot(PK11SlotInfo* slot) const { PK11_FreeSlot(slot); }
145 145
146 // Methods in Firefox security components. 146 // Methods in Firefox security components.
147 NSSInitFunc NSS_Init; 147 NSSInitFunc NSS_Init;
148 NSSShutdownFunc NSS_Shutdown; 148 NSSShutdownFunc NSS_Shutdown;
149 PK11GetInternalKeySlotFunc PK11_GetInternalKeySlot; 149 PK11GetInternalKeySlotFunc PK11_GetInternalKeySlot;
150 PK11CheckUserPasswordFunc PK11_CheckUserPassword; 150 PK11CheckUserPasswordFunc PK11_CheckUserPassword;
151 PK11FreeSlotFunc PK11_FreeSlot; 151 PK11FreeSlotFunc PK11_FreeSlot;
152 PK11AuthenticateFunc PK11_Authenticate; 152 PK11AuthenticateFunc PK11_Authenticate;
153 PK11SDRDecryptFunc PK11SDR_Decrypt; 153 PK11SDRDecryptFunc PK11SDR_Decrypt;
154 SECITEMFreeItemFunc SECITEM_FreeItem; 154 SECITEMFreeItemFunc SECITEM_FreeItem;
155 155
156 // True if NSS_Init() has been called 156 // True if NSS_Init() has been called
157 bool is_nss_initialized_; 157 bool is_nss_initialized_;
158 158
159 DISALLOW_COPY_AND_ASSIGN(NSSDecryptor); 159 DISALLOW_COPY_AND_ASSIGN(NSSDecryptor);
160 }; 160 };
161 161
162 #endif // CHROME_UTILITY_IMPORTER_NSS_DECRYPTOR_MAC_H_ 162 #endif // CHROME_UTILITY_IMPORTER_NSS_DECRYPTOR_MAC_H_
OLDNEW
« no previous file with comments | « chrome/utility/importer/nss_decryptor.cc ('k') | chrome/utility/importer/nss_decryptor_null.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698