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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
// Copyright (c) 2009 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/web_data_service.h"
#include "chrome/browser/password_manager/ie7_password.h"
void WebDataService::AddIE7Login(const IE7PasswordInfo& info) {
GenericRequest<IE7PasswordInfo>* request =
new GenericRequest<IE7PasswordInfo>(this, GetNextRequestHandle(), NULL,
info);
RegisterRequest(request);
ScheduleTask(NewRunnableMethod(this, &WebDataService::AddIE7LoginImpl,
request));
}
void WebDataService::RemoveIE7Login(const IE7PasswordInfo& info) {
GenericRequest<IE7PasswordInfo>* request =
new GenericRequest<IE7PasswordInfo>(this, GetNextRequestHandle(), NULL,
info);
RegisterRequest(request);
ScheduleTask(NewRunnableMethod(this, &WebDataService::RemoveIE7LoginImpl,
request));
}
WebDataService::Handle WebDataService::GetIE7Login(
const IE7PasswordInfo& info,
WebDataServiceConsumer* consumer) {
GenericRequest<IE7PasswordInfo>* request =
new GenericRequest<IE7PasswordInfo>(this, GetNextRequestHandle(),
consumer, info);
RegisterRequest(request);
ScheduleTask(NewRunnableMethod(this, &WebDataService::GetIE7LoginImpl,
request));
return request->GetHandle();
}
void WebDataService::AddIE7LoginImpl(GenericRequest<IE7PasswordInfo>* request) {
if (db_ && !request->IsCancelled()) {
if (db_->AddIE7Login(request->GetArgument()))
ScheduleCommit();
}
request->RequestComplete();
}
void WebDataService::RemoveIE7LoginImpl(
GenericRequest<IE7PasswordInfo>* request) {
if (db_ && !request->IsCancelled()) {
if (db_->RemoveIE7Login(request->GetArgument()))
ScheduleCommit();
}
request->RequestComplete();
}
void WebDataService::GetIE7LoginImpl(
GenericRequest<IE7PasswordInfo>* request) {
if (db_ && !request->IsCancelled()) {
IE7PasswordInfo result;
db_->GetIE7Login(request->GetArgument(), &result);
request->SetResult(
new WDResult<IE7PasswordInfo>(PASSWORD_IE7_RESULT, result));
}
request->RequestComplete();
}
|