|
1 /* |
|
2 * Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies). |
|
3 * All rights reserved. |
|
4 * This component and the accompanying materials are made available |
|
5 * under the terms of the License "Eclipse Public License v1.0" |
|
6 * which accompanies this distribution, and is available |
|
7 * at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
8 * |
|
9 * Initial Contributors: |
|
10 * Nokia Corporation - initial contribution. |
|
11 * |
|
12 * Contributors: |
|
13 * |
|
14 * Description: |
|
15 * |
|
16 */ |
|
17 |
|
18 #ifndef __FORMLOGINSTORE_H__ |
|
19 #define __FORMLOGINSTORE_H__ |
|
20 |
|
21 #include "StreamSymbian.h" |
|
22 #include "PlatformString.h" |
|
23 #include "HashSet.h" |
|
24 |
|
25 using namespace WTF; |
|
26 |
|
27 class CPBEncryptElement; |
|
28 class CPBEncryptionData; |
|
29 |
|
30 namespace WebCore { |
|
31 |
|
32 class FormLoginStore; |
|
33 |
|
34 class LoginData : public Streamable |
|
35 { |
|
36 public: |
|
37 LoginData(FormLoginStore*); |
|
38 LoginData(FormLoginStore*, const String&, const String&, const String&, const String&, const String&); |
|
39 ~LoginData(); |
|
40 |
|
41 void read(StreamInput& is); |
|
42 void write(StreamOutput& os) const; |
|
43 |
|
44 // match |
|
45 bool partialMatch(const String& realm, const String& uname, const String& uvalue, const String& pname) const; |
|
46 bool match(const LoginData&) const; |
|
47 |
|
48 // accessor |
|
49 const String& passwdValue() const { return m_passwdValue; } |
|
50 const String& realm() const { return m_realm; } |
|
51 |
|
52 private: |
|
53 String m_realm; |
|
54 String m_usernameField; |
|
55 String m_usernameValue; |
|
56 String m_passwdField; |
|
57 String m_passwdValue; |
|
58 FormLoginStore* m_store; |
|
59 }; |
|
60 |
|
61 class FormLoginStore |
|
62 { |
|
63 public: |
|
64 FormLoginStore(); |
|
65 ~FormLoginStore(); |
|
66 |
|
67 void setSaveNotAllowed(const String& url); |
|
68 bool saveAllowed(const String& url) const; |
|
69 |
|
70 // save login info to the buffer |
|
71 void add(const String& realm, const String& uname, const String& uvalue, const String& pname, const String& pvalue); |
|
72 void remove(const String& realm, const String& uname, const String& uvalue, const String& pname, const String& pvalue); |
|
73 void removePartial(const String& realm, const String& uname, const String& uvalue, const String& pname); |
|
74 bool contains(const String& realm, const String& uname, const String& uvalue, const String& pname, const String& pvalue); |
|
75 bool search(const String& realm, const String& uname, const String& uvalue, const String& pname, String& pvalue); |
|
76 |
|
77 void removeLoginsForRealm(const String& realm); |
|
78 void deleteAll(); |
|
79 |
|
80 void commit(); |
|
81 |
|
82 // encryption |
|
83 String encrypt(const String&); |
|
84 String decrypt(const String&); |
|
85 |
|
86 private: |
|
87 void initialize(); |
|
88 void clearCache(); |
|
89 |
|
90 HashSet<String> m_blackList; |
|
91 HashSet<LoginData*> m_logins; |
|
92 bool m_needCommit; |
|
93 CPBEncryptElement* m_pbEncrypt; |
|
94 CPBEncryptElement* m_pbDecrypt; |
|
95 }; |
|
96 |
|
97 } |
|
98 |
|
99 #endif //!__FORMLOGINSTORE_H__ |