| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/webdata/logins_table.h" | |
| 6 #include "chrome/browser/webdata/web_data_service.h" | 5 #include "chrome/browser/webdata/web_data_service.h" |
| 7 | 6 |
| 8 #include "base/bind.h" | 7 #include "base/bind.h" |
| 9 #include "chrome/browser/password_manager/ie7_password.h" | 8 #include "chrome/browser/password_manager/ie7_password.h" |
| 10 #include "chrome/browser/webdata/web_database.h" | 9 #include "chrome/browser/webdata/logins_table.h" |
| 10 #include "chrome/browser/webdata/web_database_service.h" |
| 11 | 11 |
| 12 using base::Bind; | 12 using base::Bind; |
| 13 | 13 |
| 14 void WebDataService::AddIE7Login(const IE7PasswordInfo& info) { | 14 void WebDataService::AddIE7Login(const IE7PasswordInfo& info) { |
| 15 ScheduleDBTask(FROM_HERE, | 15 wdbs_->ScheduleDBTask( |
| 16 Bind(&WebDataService::AddIE7LoginImpl, this, info)); | 16 FROM_HERE, Bind(&WebDataService::AddIE7LoginImpl, this, info)); |
| 17 } | 17 } |
| 18 | 18 |
| 19 void WebDataService::RemoveIE7Login(const IE7PasswordInfo& info) { | 19 void WebDataService::RemoveIE7Login(const IE7PasswordInfo& info) { |
| 20 ScheduleDBTask(FROM_HERE, | 20 wdbs_->ScheduleDBTask( |
| 21 Bind(&WebDataService::RemoveIE7LoginImpl, this, info)); | 21 FROM_HERE, Bind(&WebDataService::RemoveIE7LoginImpl, this, info)); |
| 22 } | 22 } |
| 23 | 23 |
| 24 WebDataService::Handle WebDataService::GetIE7Login( | 24 WebDataService::Handle WebDataService::GetIE7Login( |
| 25 const IE7PasswordInfo& info, | 25 const IE7PasswordInfo& info, |
| 26 WebDataServiceConsumer* consumer) { | 26 WebDataServiceConsumer* consumer) { |
| 27 return ScheduleDBTaskWithResult(FROM_HERE, | 27 return wdbs_->ScheduleDBTaskWithResult( |
| 28 Bind(&WebDataService::GetIE7LoginImpl, this, info), consumer); | 28 FROM_HERE, Bind(&WebDataService::GetIE7LoginImpl, this, info), consumer); |
| 29 } | 29 } |
| 30 | 30 |
| 31 void WebDataService::AddIE7LoginImpl(const IE7PasswordInfo& info) { | 31 WebDatabase::State WebDataService::AddIE7LoginImpl( |
| 32 if (db_->GetLoginsTable()->AddIE7Login(info)) | 32 const IE7PasswordInfo& info, WebDatabase* db) { |
| 33 ScheduleCommit(); | 33 if (db->GetLoginsTable()->AddIE7Login(info)) |
| 34 return WebDatabase::COMMIT_NEEDED; |
| 35 return WebDatabase::COMMIT_NOT_NEEDED; |
| 34 } | 36 } |
| 35 | 37 |
| 36 void WebDataService::RemoveIE7LoginImpl(const IE7PasswordInfo& info) { | 38 WebDatabase::State WebDataService::RemoveIE7LoginImpl( |
| 37 if (db_->GetLoginsTable()->RemoveIE7Login(info)) | 39 const IE7PasswordInfo& info, WebDatabase* db) { |
| 38 ScheduleCommit(); | 40 if (db->GetLoginsTable()->RemoveIE7Login(info)) |
| 41 return WebDatabase::COMMIT_NEEDED; |
| 42 return WebDatabase::COMMIT_NOT_NEEDED; |
| 39 } | 43 } |
| 40 | 44 |
| 41 scoped_ptr<WDTypedResult> WebDataService::GetIE7LoginImpl( | 45 scoped_ptr<WDTypedResult> WebDataService::GetIE7LoginImpl( |
| 42 const IE7PasswordInfo& info) { | 46 const IE7PasswordInfo& info, WebDatabase* db) { |
| 43 IE7PasswordInfo result; | 47 IE7PasswordInfo result; |
| 44 db_->GetLoginsTable()->GetIE7Login(info, &result); | 48 db->GetLoginsTable()->GetIE7Login(info, &result); |
| 45 return scoped_ptr<WDTypedResult>( | 49 return scoped_ptr<WDTypedResult>( |
| 46 new WDResult<IE7PasswordInfo>(PASSWORD_IE7_RESULT, result)); | 50 new WDResult<IE7PasswordInfo>(PASSWORD_IE7_RESULT, result)); |
| 47 } | 51 } |
| OLD | NEW |