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

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

Issue 114057: Re-land the password store work from bug 8205, with changes that should fix b... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 6 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 | Annotate | Revision Log
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_DEFAULT
6 #define CHROME_BROWSER_PASSWORD_MANAGER_PASSWORD_STORE_DEFAULT
7
8 #include <map>
9
10 #include "base/file_path.h"
11 #include "base/ref_counted.h"
12 #include "base/scoped_ptr.h"
13 #include "chrome/browser/password_manager/password_store.h"
14 #include "chrome/browser/webdata/web_data_service.h"
15
16 class Task;
17
18 // Simple password store implementation that delegates everything to
19 // the WebDatabase.
20 // TODO(stuartmorgan): This is a temprorary shim for Windows from the new
21 // PasswordStore interface to the old model of storing passwords in the
22 // WebDatabase. This should be replaced by a self-contained Windows
23 // implementation once PasswordStore is completed.
24 class PasswordStoreDefault : public PasswordStore,
25 public WebDataServiceConsumer {
26 public:
27 explicit PasswordStoreDefault(WebDataService* web_data_service);
28 virtual ~PasswordStoreDefault() {}
29
30 protected:
31 // Implements PasswordStore interface.
32 void AddLoginImpl(const PasswordForm& form);
33 void UpdateLoginImpl(const PasswordForm& form);
34 void RemoveLoginImpl(const PasswordForm& form);
35 void GetLoginsImpl(GetLoginsRequest* request);
36
37 // Called when a WebDataService method finishes.
38 // Overrides must call RemovePendingWebDataServiceRequest.
39 virtual void OnWebDataServiceRequestDone(WebDataService::Handle h,
40 const WDTypedResult* result);
41
42 // Keeps track of a pending WebDataService request, and the original
43 // GetLogins request it is associated with.
44 // Increases the reference count of |this|, so must be balanced with a
45 // call to RemovePendingWebDataServiceRequest.
46 void AddPendingWebDataServiceRequest(WebDataService::Handle handle,
47 GetLoginsRequest* request);
48 // Removes a WebDataService request from the list of pending requests,
49 // and reduces the reference count of |this|.
50 void RemovePendingWebDataServiceRequest(WebDataService::Handle handle);
51 // Returns the GetLoginsRequest associated with |handle|.
52 GetLoginsRequest* GetLoginsRequestForWebDataServiceRequest(
53 WebDataService::Handle handle);
54
55 scoped_refptr<WebDataService> web_data_service_;
56
57 private:
58 // Methods in this class call async WebDataService methods. This mapping
59 // remembers which WebDataService request corresponds to which PasswordStore
60 // request.
61 typedef std::map<WebDataService::Handle, GetLoginsRequest*> PendingRequestMap;
62 PendingRequestMap pending_requests_;
63
64 DISALLOW_COPY_AND_ASSIGN(PasswordStoreDefault);
65 };
66
67 #endif // CHROME_BROWSER_PASSWORD_MANAGER_PASSWORD_STORE_DEFAULT
OLDNEW
« no previous file with comments | « chrome/browser/password_manager/password_store.cc ('k') | chrome/browser/password_manager/password_store_default.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698