summaryrefslogtreecommitdiffstats
path: root/chrome/browser/webdata/web_data_service_win.cc
blob: 00a34e6ed45d234b2abccb22cdfd35a0426c9d2c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
// Copyright (c) 2011 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/logins_table.h"
#include "chrome/browser/webdata/web_data_service.h"

#include "base/bind.h"
#include "chrome/browser/password_manager/ie7_password.h"
#include "chrome/browser/webdata/web_database.h"

using base::Bind;

void WebDataService::AddIE7Login(const IE7PasswordInfo& info) {
  ScheduleDBTask(FROM_HERE,
                 Bind(&WebDataService::AddIE7LoginImpl, this, info));
}

void WebDataService::RemoveIE7Login(const IE7PasswordInfo& info) {
  ScheduleDBTask(FROM_HERE,
                 Bind(&WebDataService::RemoveIE7LoginImpl, this, info));
}

WebDataService::Handle WebDataService::GetIE7Login(
    const IE7PasswordInfo& info,
    WebDataServiceConsumer* consumer) {
  return ScheduleDBTaskWithResult(FROM_HERE,
      Bind(&WebDataService::GetIE7LoginImpl, this, info), consumer);
}

void WebDataService::AddIE7LoginImpl(const IE7PasswordInfo& info) {
  if (db_->GetLoginsTable()->AddIE7Login(info))
      ScheduleCommit();
}

void WebDataService::RemoveIE7LoginImpl(const IE7PasswordInfo& info) {
  if (db_->GetLoginsTable()->RemoveIE7Login(info))
    ScheduleCommit();
}

scoped_ptr<WDTypedResult> WebDataService::GetIE7LoginImpl(
    const IE7PasswordInfo& info) {
    IE7PasswordInfo result;
    db_->GetLoginsTable()->GetIE7Login(info, &result);
    return scoped_ptr<WDTypedResult>(
        new WDResult<IE7PasswordInfo>(PASSWORD_IE7_RESULT, result));
}