OLD | NEW |
| (Empty) |
1 // Copyright (c) 2011 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/web_data_service.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 | |
12 using base::Bind; | |
13 | |
14 void WebDataService::AddIE7Login(const IE7PasswordInfo& info) { | |
15 wdbs_->ScheduleDBTask( | |
16 FROM_HERE, Bind(&WebDataService::AddIE7LoginImpl, this, info)); | |
17 } | |
18 | |
19 void WebDataService::RemoveIE7Login(const IE7PasswordInfo& info) { | |
20 wdbs_->ScheduleDBTask( | |
21 FROM_HERE, Bind(&WebDataService::RemoveIE7LoginImpl, this, info)); | |
22 } | |
23 | |
24 WebDataService::Handle WebDataService::GetIE7Login( | |
25 const IE7PasswordInfo& info, | |
26 WebDataServiceConsumer* consumer) { | |
27 return wdbs_->ScheduleDBTaskWithResult( | |
28 FROM_HERE, Bind(&WebDataService::GetIE7LoginImpl, this, info), consumer); | |
29 } | |
30 | |
31 WebDatabase::State WebDataService::AddIE7LoginImpl( | |
32 const IE7PasswordInfo& info, WebDatabase* db) { | |
33 if (LoginsTable::FromWebDatabase(db)->AddIE7Login(info)) | |
34 return WebDatabase::COMMIT_NEEDED; | |
35 return WebDatabase::COMMIT_NOT_NEEDED; | |
36 } | |
37 | |
38 WebDatabase::State WebDataService::RemoveIE7LoginImpl( | |
39 const IE7PasswordInfo& info, WebDatabase* db) { | |
40 if (LoginsTable::FromWebDatabase(db)->RemoveIE7Login(info)) | |
41 return WebDatabase::COMMIT_NEEDED; | |
42 return WebDatabase::COMMIT_NOT_NEEDED; | |
43 } | |
44 | |
45 scoped_ptr<WDTypedResult> WebDataService::GetIE7LoginImpl( | |
46 const IE7PasswordInfo& info, WebDatabase* db) { | |
47 IE7PasswordInfo result; | |
48 LoginsTable::FromWebDatabase(db)->GetIE7Login(info, &result); | |
49 return scoped_ptr<WDTypedResult>( | |
50 new WDResult<IE7PasswordInfo>(PASSWORD_IE7_RESULT, result)); | |
51 } | |
OLD | NEW |