Disable view source for Developer Tools.
[chromium-blink-merge.git] / chrome / browser / webdata / web_data_service_win.cc
blob7530ada282ff1255f7e7321714353d9f27cb3c4d
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.
5 #include "chrome/browser/webdata/web_data_service.h"
7 #include "base/bind.h"
8 #include "chrome/browser/webdata/logins_table.h"
9 #include "components/webdata/common/web_database_service.h"
10 #include "components/webdata/encryptor/ie7_password_win.h"
12 using base::Bind;
14 void WebDataService::AddIE7Login(const IE7PasswordInfo& info) {
15 wdbs_->ScheduleDBTask(
16 FROM_HERE, Bind(&WebDataService::AddIE7LoginImpl, this, info));
19 void WebDataService::RemoveIE7Login(const IE7PasswordInfo& info) {
20 wdbs_->ScheduleDBTask(
21 FROM_HERE, Bind(&WebDataService::RemoveIE7LoginImpl, this, info));
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);
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;
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;
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));