OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2016 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. | |
4 | |
5 #ifndef COMPONENTS_AUTOFILL_CORE_BROWSER_ASSIST_MANAGER_H_ | |
6 #define COMPONENTS_AUTOFILL_CORE_BROWSER_ASSIST_MANAGER_H_ | |
7 | |
8 #include <memory> | |
9 #include <vector> | |
10 | |
11 #include "base/macros.h" | |
12 #include "base/memory/weak_ptr.h" | |
13 #include "components/autofill/core/common/form_data.h" | |
14 | |
15 namespace autofill { | |
16 | |
17 class AutofillManager; | |
18 class CreditCard; | |
19 class FormStructure; | |
20 | |
21 // This class encompasses the triggering rules and the logic for the autofill | |
22 // assisted filling mechanisms. | |
Peter Kasting
2016/08/03 02:25:40
Is this going to be "assisting" lots more things t
Mathieu
2016/08/03 18:34:44
Yes it will be an assistant for other things in th
| |
23 class AssistManager { | |
24 public: | |
25 explicit AssistManager(AutofillManager* autofill_manager); | |
26 ~AssistManager(); | |
27 | |
28 // Should be called at every page navigation to clear state. | |
29 void Reset(); | |
30 | |
31 // Returns whether a credit card assist can be shown. Will go through the | |
32 // forms in |form_structures| and extract the credit card form. | |
33 bool CanShowCreditCardAssist( | |
34 const std::vector<FormStructure*>& form_structures); | |
35 | |
36 // Will show an assist infobar for the previously extracted form proposing to | |
37 // autofill it. Should only be called if CanShowCreditCardAssist() returned | |
38 // true. | |
39 void ShowAssistForCreditCard(const CreditCard& card); | |
40 | |
41 private: | |
42 // Callback to the user accepting the infobar. | |
Peter Kasting
2016/08/03 02:25:40
Nit: The grammar of this sentence is confusing, es
Mathieu
2016/08/03 18:34:44
Done.
| |
43 void OnUserDidAcceptCreditCardFill(const CreditCard& card); | |
44 | |
45 // Holds the FormData to be filled with a credit card. | |
46 std::unique_ptr<FormData> credit_card_form_data_; | |
47 | |
48 // Weak reference to the AutofillManager that created and maintains this | |
49 // AssistManager. | |
50 AutofillManager* autofill_manager_; | |
51 | |
52 base::WeakPtrFactory<AssistManager> weak_ptr_factory_; | |
53 | |
54 DISALLOW_COPY_AND_ASSIGN(AssistManager); | |
55 }; | |
56 | |
57 } // namespace autofill | |
58 | |
59 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_ASSIST_MANAGER_H_ | |
OLD | NEW |