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

Side by Side Diff: chrome/browser/password_manager/password_store_kwallet.h

Issue 113871: Revert the password manager refactoring -- it failed reliability tests. (Closed)
Patch Set: Created 11 years, 7 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
OLDNEW
(Empty)
1 // Copyright (c) 2006-2009 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef CHROME_BROWSER_PASSWORD_MANAGER_PASSWORD_STORE_KWALLET
6 #define CHROME_BROWSER_PASSWORD_MANAGER_PASSWORD_STORE_KWALLET
7
8 #include <dbus/dbus-glib.h>
9 #include <glib.h>
10
11 #include <string>
12 #include <vector>
13
14 #include "base/lock.h"
15 #include "base/thread.h"
16 #include "chrome/browser/password_manager/password_store.h"
17 #include "webkit/glue/password_form.h"
18
19 class Pickle;
20 class Profile;
21 class Task;
22
23 class PasswordStoreKWallet : public PasswordStore {
24 public:
25 PasswordStoreKWallet();
26 virtual ~PasswordStoreKWallet();
27
28 bool Init();
29
30 private:
31 typedef std::vector<PasswordForm*> PasswordFormList;
32
33 // Implements PasswordStore interface.
34 void AddLoginImpl(const PasswordForm& form);
35 void UpdateLoginImpl(const PasswordForm& form);
36 void RemoveLoginImpl(const PasswordForm& form);
37 void GetLoginsImpl(GetLoginsRequest* request);
38
39 // Initialisation.
40 bool StartKWalletd();
41 bool InitWallet();
42
43 // Reads a list of PasswordForms from the wallet that match the signon_realm
44 // of key.
45 void GetLoginsList(PasswordFormList* forms, const PasswordForm& key,
46 int wallet_handle);
47
48 // Writes a list of PasswordForms to the wallet with the signon_realm from
49 // key. Overwrites any existing list for this key.
50 void SetLoginsList(const PasswordFormList& forms, const PasswordForm& key,
51 int wallet_handle);
52
53 // Checks if the last dbus call returned an error. If it did, logs the error
54 // message, frees it and returns true.
55 // This must be called after every dbus call.
56 bool CheckError();
57
58 // Opens the wallet and ensures that the "Chrome Form Data" folder exists.
59 // Returns kInvalidWalletHandle on error.
60 int WalletHandle();
61
62 // Compares two PasswordForms and returns true if they are the same.
63 // Checks only the fields that we persist in KWallet, and ignores
64 // password_value.
65 static bool CompareForms(const PasswordForm& a, const PasswordForm& b);
66
67 // Serializes a list of PasswordForms to be stored in the wallet.
68 static void SerializeValue(const PasswordFormList& forms, Pickle* pickle);
69
70 // Deserializes a list of PasswordForms from the wallet.
71 static void DeserializeValue(const PasswordForm& key, const Pickle& pickle,
72 PasswordFormList* forms);
73
74 // Convenience function to read a GURL from a Pickle. Assumes the URL has
75 // been written as a std::string.
76 static void ReadGURL(const Pickle& pickle, void** iter, GURL* url);
77
78 // Name of the application - will appear in kwallet's dialogs.
79 static const char* kAppId;
80 // Name of the folder to store passwords in.
81 static const char* kKWalletFolder;
82
83 // DBUS stuff.
84 static const char* kKWalletServiceName;
85 static const char* kKWalletPath;
86 static const char* kKWalletInterface;
87 static const char* kKLauncherServiceName;
88 static const char* kKLauncherPath;
89 static const char* kKLauncherInterface;
90
91 // Invalid handle returned by WalletHandle().
92 static const int kInvalidKWalletHandle = -1;
93
94 // Controls all access to kwallet dbus calls.
95 Lock kwallet_lock_;
96
97 // Error from the last dbus call. NULL when there's no error. Freed and
98 // cleared by CheckError().
99 GError* error_;
100 // Connection to the dbus session bus.
101 DBusGConnection* connection_;
102 // Proxy to the kwallet dbus service.
103 DBusGProxy* proxy_;
104
105 // The name of the wallet we've opened. Set during Init().
106 std::string wallet_name_;
107
108 DISALLOW_COPY_AND_ASSIGN(PasswordStoreKWallet);
109 };
110
111 #endif // CHROME_BROWSER_PASSWORD_MANAGER_PASSWORD_STORE_KWALLET
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698