OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_POPUP_DELEGATE_H_ | 5 #ifndef COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_POPUP_DELEGATE_H_ |
6 #define COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_POPUP_DELEGATE_H_ | 6 #define COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_POPUP_DELEGATE_H_ |
7 | 7 |
8 #include "base/strings/string16.h" | 8 #include "base/strings/string16.h" |
9 | 9 |
10 namespace autofill { | 10 namespace autofill { |
11 | 11 |
12 // An interface for interaction with AutofillPopupController. Will be notified | 12 // An interface for interaction with AutofillPopupController. Will be notified |
13 // of events by the controller. | 13 // of events by the controller. |
14 class AutofillPopupDelegate { | 14 class AutofillPopupDelegate { |
15 public: | 15 public: |
16 // Called when the Autofill popup is shown. | 16 // Called when the Autofill popup is shown. |
17 virtual void OnPopupShown() = 0; | 17 virtual void OnPopupShown() = 0; |
18 | 18 |
19 // Called when the Autofill popup is hidden. | 19 // Called when the Autofill popup is hidden. |
20 virtual void OnPopupHidden() = 0; | 20 virtual void OnPopupHidden() = 0; |
21 | 21 |
22 // Called when the autofill suggestion indicated by |identifier| has been | 22 // Called when the autofill suggestion indicated by |identifier| has been |
23 // temporarily selected (e.g., hovered). | 23 // temporarily selected (e.g., hovered). |
24 virtual void DidSelectSuggestion(const base::string16& value, | 24 virtual void DidSelectSuggestion(const base::string16& value, |
25 int identifier) = 0; | 25 int identifier, |
| 26 size_t match_start) = 0; |
26 | 27 |
27 // Inform the delegate that a row in the popup has been chosen. | 28 // Inform the delegate that a row in the popup has been chosen. |
28 virtual void DidAcceptSuggestion(const base::string16& value, | 29 virtual void DidAcceptSuggestion(const base::string16& value, |
29 int identifier, | 30 int identifier, |
30 int position) = 0; | 31 int position) = 0; |
31 | 32 |
32 // Returns whether the given value can be deleted, and if true, | 33 // Returns whether the given value can be deleted, and if true, |
33 // fills out |title| and |body|. | 34 // fills out |title| and |body|. |
34 virtual bool GetDeletionConfirmationText(const base::string16& value, | 35 virtual bool GetDeletionConfirmationText(const base::string16& value, |
35 int identifier, | 36 int identifier, |
36 base::string16* title, | 37 base::string16* title, |
37 base::string16* body) = 0; | 38 base::string16* body) = 0; |
38 | 39 |
39 // Delete the described suggestion. Returns true if something was deleted, | 40 // Delete the described suggestion. Returns true if something was deleted, |
40 // or false if deletion is not allowed. | 41 // or false if deletion is not allowed. |
41 virtual bool RemoveSuggestion(const base::string16& value, | 42 virtual bool RemoveSuggestion(const base::string16& value, |
42 int identifier) = 0; | 43 int identifier) = 0; |
43 | 44 |
44 // Informs the delegate that the Autofill previewed form should be cleared. | 45 // Informs the delegate that the Autofill previewed form should be cleared. |
45 virtual void ClearPreviewedForm() = 0; | 46 virtual void ClearPreviewedForm() = 0; |
46 }; | 47 }; |
47 | 48 |
48 } // namespace autofill | 49 } // namespace autofill |
49 | 50 |
50 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_POPUP_DELEGATE_H_ | 51 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_AUTOFILL_POPUP_DELEGATE_H_ |
OLD | NEW |