OLD | NEW |
| (Empty) |
1 // Copyright 2014 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 #include "chrome/browser/webdata/password_web_data_service_win.h" | |
6 | |
7 #include "base/bind.h" | |
8 #include "chrome/browser/webdata/logins_table.h" | |
9 #include "components/os_crypt/ie7_password_win.h" | |
10 #include "components/webdata/common/web_database_service.h" | |
11 #include "content/public/browser/browser_thread.h" | |
12 | |
13 PasswordWebDataService::PasswordWebDataService( | |
14 scoped_refptr<WebDatabaseService> wdbs, | |
15 const ProfileErrorCallback& callback) | |
16 : WebDataServiceBase( | |
17 wdbs, | |
18 callback, | |
19 content::BrowserThread::GetMessageLoopProxyForThread( | |
20 content::BrowserThread::UI)) { | |
21 } | |
22 | |
23 void PasswordWebDataService::AddIE7Login(const IE7PasswordInfo& info) { | |
24 wdbs_->ScheduleDBTask( | |
25 FROM_HERE, | |
26 base::Bind(&PasswordWebDataService::AddIE7LoginImpl, this, info)); | |
27 } | |
28 | |
29 void PasswordWebDataService::RemoveIE7Login(const IE7PasswordInfo& info) { | |
30 wdbs_->ScheduleDBTask( | |
31 FROM_HERE, | |
32 base::Bind(&PasswordWebDataService::RemoveIE7LoginImpl, this, info)); | |
33 } | |
34 | |
35 PasswordWebDataService::Handle PasswordWebDataService::GetIE7Login( | |
36 const IE7PasswordInfo& info, | |
37 WebDataServiceConsumer* consumer) { | |
38 return wdbs_->ScheduleDBTaskWithResult( | |
39 FROM_HERE, | |
40 base::Bind(&PasswordWebDataService::GetIE7LoginImpl, this, info), | |
41 consumer); | |
42 } | |
43 | |
44 WebDatabase::State PasswordWebDataService::AddIE7LoginImpl( | |
45 const IE7PasswordInfo& info, | |
46 WebDatabase* db) { | |
47 return LoginsTable::FromWebDatabase(db)->AddIE7Login(info) ? | |
48 WebDatabase::COMMIT_NEEDED : WebDatabase::COMMIT_NOT_NEEDED; | |
49 } | |
50 | |
51 WebDatabase::State PasswordWebDataService::RemoveIE7LoginImpl( | |
52 const IE7PasswordInfo& info, | |
53 WebDatabase* db) { | |
54 return LoginsTable::FromWebDatabase(db)->RemoveIE7Login(info) ? | |
55 WebDatabase::COMMIT_NEEDED : WebDatabase::COMMIT_NOT_NEEDED; | |
56 } | |
57 | |
58 scoped_ptr<WDTypedResult> PasswordWebDataService::GetIE7LoginImpl( | |
59 const IE7PasswordInfo& info, | |
60 WebDatabase* db) { | |
61 IE7PasswordInfo result; | |
62 LoginsTable::FromWebDatabase(db)->GetIE7Login(info, &result); | |
63 return scoped_ptr<WDTypedResult>( | |
64 new WDResult<IE7PasswordInfo>(PASSWORD_IE7_RESULT, result)); | |
65 } | |
66 | |
67 //////////////////////////////////////////////////////////////////////////////// | |
68 | |
69 PasswordWebDataService::PasswordWebDataService() | |
70 : WebDataServiceBase( | |
71 NULL, | |
72 ProfileErrorCallback(), | |
73 content::BrowserThread::GetMessageLoopProxyForThread( | |
74 content::BrowserThread::UI)) { | |
75 } | |
76 | |
77 PasswordWebDataService::~PasswordWebDataService() { | |
78 } | |
OLD | NEW |