OLD | NEW |
| (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 class PasswordStoreDefault : public PasswordStore, | |
21 public WebDataServiceConsumer { | |
22 public: | |
23 explicit PasswordStoreDefault(WebDataService* web_data_service); | |
24 virtual ~PasswordStoreDefault(); | |
25 | |
26 protected: | |
27 // Implements PasswordStore interface. | |
28 void AddLoginImpl(const PasswordForm& form); | |
29 void UpdateLoginImpl(const PasswordForm& form); | |
30 void RemoveLoginImpl(const PasswordForm& form); | |
31 void GetLoginsImpl(GetLoginsRequest* request); | |
32 | |
33 // Called when a WebDataService method finishes. | |
34 virtual void OnWebDataServiceRequestDone(WebDataService::Handle h, | |
35 const WDTypedResult* result); | |
36 | |
37 scoped_refptr<WebDataService> web_data_service_; | |
38 | |
39 // Methods in this class call async WebDataService methods. This mapping | |
40 // remembers which WebDataService request corresponds to which PasswordStore | |
41 // request. | |
42 typedef std::map<WebDataService::Handle, GetLoginsRequest*> PendingRequestMap; | |
43 PendingRequestMap pending_requests_; | |
44 | |
45 private: | |
46 DISALLOW_COPY_AND_ASSIGN(PasswordStoreDefault); | |
47 }; | |
48 | |
49 #endif // CHROME_BROWSER_PASSWORD_MANAGER_PASSWORD_STORE_DEFAULT | |
OLD | NEW |