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

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

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

Powered by Google App Engine
This is Rietveld 408576698