Index: chrome/browser/webdata/password_web_data_service_win.cc |
diff --git a/chrome/browser/webdata/password_web_data_service_win.cc b/chrome/browser/webdata/password_web_data_service_win.cc |
new file mode 100644 |
index 0000000000000000000000000000000000000000..3bfec32d5fac5a13f8ea5c0130f50415d53da4c2 |
--- /dev/null |
+++ b/chrome/browser/webdata/password_web_data_service_win.cc |
@@ -0,0 +1,85 @@ |
+// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#include "chrome/browser/webdata/password_web_data_service_win.h" |
+ |
+#include "base/bind.h" |
+#include "chrome/browser/webdata/logins_table.h" |
+#include "components/os_crypt/ie7_password_win.h" |
+#include "components/webdata/common/web_database_service.h" |
+#include "content/public/browser/browser_thread.h" |
+ |
+//////////////////////////////////////////////////////////////////////////////// |
+// |
+// PasswordWebDataService implementation. |
+// |
+//////////////////////////////////////////////////////////////////////////////// |
Peter Kasting
2014/07/07 23:20:03
Nit: This comment seems completely unnecessary, as
Cait (Slow)
2014/07/09 15:23:15
Done.
|
+ |
+using base::Bind; |
+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.
|
+ |
+PasswordWebDataService::PasswordWebDataService( |
+ scoped_refptr<WebDatabaseService> wdbs, |
+ const ProfileErrorCallback& callback) |
+ : WebDataServiceBase( |
+ wdbs, |
+ callback, |
+ BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI)) { |
+} |
+ |
+void PasswordWebDataService::AddIE7Login(const IE7PasswordInfo& info) { |
+ wdbs_->ScheduleDBTask( |
+ FROM_HERE, Bind(&PasswordWebDataService::AddIE7LoginImpl, this, info)); |
+} |
+ |
+void PasswordWebDataService::RemoveIE7Login(const IE7PasswordInfo& info) { |
+ wdbs_->ScheduleDBTask( |
+ FROM_HERE, Bind(&PasswordWebDataService::RemoveIE7LoginImpl, this, info)); |
+} |
+ |
+PasswordWebDataService::Handle PasswordWebDataService::GetIE7Login( |
+ const IE7PasswordInfo& info, |
+ WebDataServiceConsumer* consumer) { |
+ return wdbs_->ScheduleDBTaskWithResult( |
+ FROM_HERE, |
+ Bind(&PasswordWebDataService::GetIE7LoginImpl, this, info), |
+ consumer); |
+} |
+ |
+WebDatabase::State PasswordWebDataService::AddIE7LoginImpl( |
+ const IE7PasswordInfo& info, |
+ WebDatabase* db) { |
+ if (LoginsTable::FromWebDatabase(db)->AddIE7Login(info)) |
+ return WebDatabase::COMMIT_NEEDED; |
+ 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.
|
+} |
+ |
+WebDatabase::State PasswordWebDataService::RemoveIE7LoginImpl( |
+ const IE7PasswordInfo& info, |
+ WebDatabase* db) { |
+ if (LoginsTable::FromWebDatabase(db)->RemoveIE7Login(info)) |
+ return WebDatabase::COMMIT_NEEDED; |
+ return WebDatabase::COMMIT_NOT_NEEDED; |
+} |
+ |
+scoped_ptr<WDTypedResult> PasswordWebDataService::GetIE7LoginImpl( |
+ const IE7PasswordInfo& info, |
+ WebDatabase* db) { |
+ IE7PasswordInfo result; |
+ LoginsTable::FromWebDatabase(db)->GetIE7Login(info, &result); |
+ return scoped_ptr<WDTypedResult>( |
+ new WDResult<IE7PasswordInfo>(PASSWORD_IE7_RESULT, result)); |
+} |
+ |
+//////////////////////////////////////////////////////////////////////////////// |
+ |
+PasswordWebDataService::PasswordWebDataService() |
+ : WebDataServiceBase( |
+ NULL, |
+ ProfileErrorCallback(), |
+ BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI)) { |
+} |
+ |
+PasswordWebDataService::~PasswordWebDataService() { |
+} |