Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2012 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 //////////////////////////////////////////////////////////////////////////////// | |
| 14 // | |
| 15 // PasswordWebDataService implementation. | |
| 16 // | |
| 17 //////////////////////////////////////////////////////////////////////////////// | |
|
Peter Kasting
2014/07/07 23:20:03
Nit: This comment seems completely unnecessary, as
Cait (Slow)
2014/07/09 15:23:15
Done.
| |
| 18 | |
| 19 using base::Bind; | |
| 20 using content::BrowserThread; | |
|
Peter Kasting
2014/07/07 23:20:03
Nit: Try to avoid using directives unless they mak
Cait (Slow)
2014/07/09 15:23:15
Done.
| |
| 21 | |
| 22 PasswordWebDataService::PasswordWebDataService( | |
| 23 scoped_refptr<WebDatabaseService> wdbs, | |
| 24 const ProfileErrorCallback& callback) | |
| 25 : WebDataServiceBase( | |
| 26 wdbs, | |
| 27 callback, | |
| 28 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI)) { | |
| 29 } | |
| 30 | |
| 31 void PasswordWebDataService::AddIE7Login(const IE7PasswordInfo& info) { | |
| 32 wdbs_->ScheduleDBTask( | |
| 33 FROM_HERE, Bind(&PasswordWebDataService::AddIE7LoginImpl, this, info)); | |
| 34 } | |
| 35 | |
| 36 void PasswordWebDataService::RemoveIE7Login(const IE7PasswordInfo& info) { | |
| 37 wdbs_->ScheduleDBTask( | |
| 38 FROM_HERE, Bind(&PasswordWebDataService::RemoveIE7LoginImpl, this, info)); | |
| 39 } | |
| 40 | |
| 41 PasswordWebDataService::Handle PasswordWebDataService::GetIE7Login( | |
| 42 const IE7PasswordInfo& info, | |
| 43 WebDataServiceConsumer* consumer) { | |
| 44 return wdbs_->ScheduleDBTaskWithResult( | |
| 45 FROM_HERE, | |
| 46 Bind(&PasswordWebDataService::GetIE7LoginImpl, this, info), | |
| 47 consumer); | |
| 48 } | |
| 49 | |
| 50 WebDatabase::State PasswordWebDataService::AddIE7LoginImpl( | |
| 51 const IE7PasswordInfo& info, | |
| 52 WebDatabase* db) { | |
| 53 if (LoginsTable::FromWebDatabase(db)->AddIE7Login(info)) | |
| 54 return WebDatabase::COMMIT_NEEDED; | |
| 55 return WebDatabase::COMMIT_NOT_NEEDED; | |
|
Peter Kasting
2014/07/07 23:20:03
Nit: I might collapse this to:
return LoginsTab
Cait (Slow)
2014/07/09 15:23:15
Done.
| |
| 56 } | |
| 57 | |
| 58 WebDatabase::State PasswordWebDataService::RemoveIE7LoginImpl( | |
| 59 const IE7PasswordInfo& info, | |
| 60 WebDatabase* db) { | |
| 61 if (LoginsTable::FromWebDatabase(db)->RemoveIE7Login(info)) | |
| 62 return WebDatabase::COMMIT_NEEDED; | |
| 63 return WebDatabase::COMMIT_NOT_NEEDED; | |
| 64 } | |
| 65 | |
| 66 scoped_ptr<WDTypedResult> PasswordWebDataService::GetIE7LoginImpl( | |
| 67 const IE7PasswordInfo& info, | |
| 68 WebDatabase* db) { | |
| 69 IE7PasswordInfo result; | |
| 70 LoginsTable::FromWebDatabase(db)->GetIE7Login(info, &result); | |
| 71 return scoped_ptr<WDTypedResult>( | |
| 72 new WDResult<IE7PasswordInfo>(PASSWORD_IE7_RESULT, result)); | |
| 73 } | |
| 74 | |
| 75 //////////////////////////////////////////////////////////////////////////////// | |
| 76 | |
| 77 PasswordWebDataService::PasswordWebDataService() | |
| 78 : WebDataServiceBase( | |
| 79 NULL, | |
| 80 ProfileErrorCallback(), | |
| 81 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI)) { | |
| 82 } | |
| 83 | |
| 84 PasswordWebDataService::~PasswordWebDataService() { | |
| 85 } | |
| OLD | NEW |