This repository was archived by the owner on Jan 4, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 110
/
Copy pathatom_api_autofill.h
83 lines (59 loc) · 2.18 KB
/
atom_api_autofill.h
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
// Copyright (c) 2016 GitHub, Inc.
// Use of this source code is governed by the MIT license that can be
// found in the LICENSE file.
#ifndef ATOM_BROWSER_API_ATOM_API_AUTOFILL_H_
#define ATOM_BROWSER_API_ATOM_API_AUTOFILL_H_
#include <string>
#include "atom/browser/api/trackable_object.h"
#include "base/callback.h"
#include "brave/browser/brave_browser_context.h"
#include "components/autofill/core/browser/personal_data_manager_observer.h"
#include "native_mate/handle.h"
namespace autofill {
class AutofillProfile;
class PersonalDataManager;
}
namespace base {
class DictionaryValue;
class ListValue;
}
namespace brave {
class BraveBrowserContext;
}
namespace atom {
namespace api {
class Autofill : public mate::TrackableObject<Autofill>,
public autofill::PersonalDataManagerObserver {
public:
static mate::Handle<Autofill> Create(v8::Isolate* isolate,
content::BrowserContext* browser_context);
// mate::TrackableObject:
static void BuildPrototype(v8::Isolate* isolate,
v8::Local<v8::FunctionTemplate> prototype);
protected:
Autofill(v8::Isolate* isolate, content::BrowserContext* browser_context);
~Autofill() override;
void AddProfile(const base::DictionaryValue& profile);
autofill::AutofillProfile* GetProfile(const std::string& guid);
void RemoveProfile(const std::string& guid);
void AddCreditCard(const base::DictionaryValue& card);
autofill::CreditCard* GetCreditCard(const std::string& guid);
void RemoveCreditCard(const std::string& guid);
void ClearAutocompleteData();
void ClearAutofillData();
// PersonalDataManagerObserver
void OnPersonalDataChanged() override;
brave::BraveBrowserContext* browser_context() {
return static_cast<brave::BraveBrowserContext*>(browser_context_);
}
private:
void OnClearedAutocompleteData();
void OnClearedAutofillData();
content::BrowserContext* browser_context_; // not owned
autofill::PersonalDataManager* personal_data_manager_; // not owned
base::WeakPtrFactory<Autofill> weak_ptr_factory_;
DISALLOW_COPY_AND_ASSIGN(Autofill);
};
} // namespace api
} // namespace atom
#endif // ATOM_BROWSER_API_ATOM_API_AUTOFILL_H_