Chromium Code Reviews| 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 class AssistManager { | |
| 22 public: | |
| 23 explicit AssistManager(AutofillManager* autofill_manager); | |
| 24 ~AssistManager(); | |
| 25 | |
| 26 // Returns whether an assist can be shown. Will go through the forms in | |
| 27 // |form_structures| and extract the credit card form. | |
| 28 bool CanShowCreditCardAssist( | |
| 29 const std::vector<FormStructure*>& form_structures); | |
| 30 | |
| 31 // Should be called at every page navigation to clear state. | |
| 32 void Reset(); | |
| 33 | |
| 34 // Will show an assist infobar for the previously extracted form. Can only | |
| 35 // be called if CanShowCreditCardAssist() returned true. | |
| 36 void ShowAssistForCreditCard(const CreditCard& card); | |
| 37 | |
| 38 private: | |
| 39 void OnUserDidAcceptCreditCardFill(const CreditCard& card); | |
| 40 | |
| 41 // Holds the FormData to be filled with a credit card. | |
| 42 std::unique_ptr<FormData> credit_card_form_data_; | |
| 43 | |
| 44 AutofillManager* autofill_manager_; // Weakly owned. | |
|
please use gerrit instead
2016/07/27 17:02:26
s/Weakly owned/Weak/ --- because it's not owned.
Mathieu
2016/07/27 21:35:52
Done.
| |
| 45 | |
| 46 base::WeakPtrFactory<AssistManager> weak_ptr_factory_; | |
| 47 | |
| 48 DISALLOW_COPY_AND_ASSIGN(AssistManager); | |
| 49 }; | |
| 50 | |
| 51 } // namespace autofill | |
| 52 | |
| 53 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_ASSIST_MANAGER_H_ | |
| OLD | NEW |