| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 #ifndef WebAutofillClient_h | 31 #ifndef WebAutofillClient_h |
| 32 #define WebAutofillClient_h | 32 #define WebAutofillClient_h |
| 33 | 33 |
| 34 namespace WebKit { | 34 namespace WebKit { |
| 35 | 35 |
| 36 enum { |
| 37 AutocompleteEntryMenuItemID = 0, |
| 38 WarningMessageMenuItemID = -1, |
| 39 PasswordEntryMenuItemID = -2, |
| 40 SeparatorMenuItemID = -3, |
| 41 ClearFormMenuItemID = -4, |
| 42 AutofillOptionsMenuItemID = -5, |
| 43 DataListEntryMenuItemID = -6 |
| 44 }; |
| 45 |
| 36 class WebInputElement; | 46 class WebInputElement; |
| 37 class WebKeyboardEvent; | 47 class WebKeyboardEvent; |
| 38 class WebNode; | 48 class WebNode; |
| 39 class WebString; | 49 class WebString; |
| 40 | 50 |
| 41 class WebAutofillClient { | 51 class WebAutofillClient { |
| 42 public: | 52 public: |
| 43 // Informs the browser that the user has accepted an Autofill suggestion for | 53 // Informs the browser that the user has accepted an Autofill suggestion for |
| 44 // a WebNode. |uniqueID| is used as a key into the set of Autofill profiles
, | 54 // a WebNode. |uniqueID| is used as a key into the set of Autofill profiles
, |
| 45 // and should never be negative. If it is 0, then the suggestion is an | 55 // and should never be negative. If it is 0, then the suggestion is an |
| 46 // Autocomplete suggestion; and |value| stores the suggested text. |index| | 56 // Autocomplete suggestion; and |value| stores the suggested text. |index| |
| 47 // is an index of the selected suggestion in the list of suggestions provide
d | 57 // is an index of the selected suggestion in the list of suggestions provide
d |
| 48 // by the client. | 58 // by the client. |
| 49 virtual void didAcceptAutofillSuggestion(const WebNode&, | 59 virtual void didAcceptAutofillSuggestion(const WebNode&, |
| 50 const WebString& value, | 60 const WebString& value, |
| 51 const WebString& label, | 61 const WebString& label, |
| 52 int uniqueID, | 62 int itemID, |
| 53 unsigned index) { } | 63 unsigned index) { } |
| 54 | 64 |
| 55 // Informs the browser that the user has selected an Autofill suggestion for | 65 // Informs the browser that the user has selected an Autofill suggestion for |
| 56 // a WebNode. This happens when the user hovers over a suggestion or uses | 66 // a WebNode. This happens when the user hovers over a suggestion or uses |
| 57 // the arrow keys to navigate to a suggestion. | 67 // the arrow keys to navigate to a suggestion. |
| 58 virtual void didSelectAutofillSuggestion(const WebNode&, | 68 virtual void didSelectAutofillSuggestion(const WebNode&, |
| 59 const WebString& name, | 69 const WebString& name, |
| 60 const WebString& label, | 70 const WebString& label, |
| 61 int uniqueID) { } | 71 int itemID) { } |
| 62 | 72 |
| 63 // Informs the browser that the user has cleared the selection from the | 73 // Informs the browser that the user has cleared the selection from the |
| 64 // Autofill suggestions popup. This happens when a user uses the arrow | 74 // Autofill suggestions popup. This happens when a user uses the arrow |
| 65 // keys to navigate outside the range of possible selections. | 75 // keys to navigate outside the range of possible selections. |
| 66 virtual void didClearAutofillSelection(const WebNode&) { } | 76 virtual void didClearAutofillSelection(const WebNode&) { } |
| 67 | 77 |
| 68 // Instructs the browser to remove the Autocomplete entry specified from | 78 // Instructs the browser to remove the Autocomplete entry specified from |
| 69 // its DB. | 79 // its DB. |
| 70 virtual void removeAutocompleteSuggestion(const WebString& name, | 80 virtual void removeAutocompleteSuggestion(const WebString& name, |
| 71 const WebString& value) { } | 81 const WebString& value) { } |
| 72 | 82 |
| 73 // These methods are called when the users edits a text-field. | 83 // These methods are called when the users edits a text-field. |
| 74 virtual void textFieldDidEndEditing(const WebInputElement&) { } | 84 virtual void textFieldDidEndEditing(const WebInputElement&) { } |
| 75 virtual void textFieldDidChange(const WebInputElement&) { } | 85 virtual void textFieldDidChange(const WebInputElement&) { } |
| 76 virtual void textFieldDidReceiveKeyDown(const WebInputElement&, const WebKey
boardEvent&) { } | 86 virtual void textFieldDidReceiveKeyDown(const WebInputElement&, const WebKey
boardEvent&) { } |
| 77 | 87 |
| 78 protected: | 88 protected: |
| 79 ~WebAutofillClient() { } | 89 ~WebAutofillClient() { } |
| 80 }; | 90 }; |
| 81 | 91 |
| 82 } // namespace WebKit | 92 } // namespace WebKit |
| 83 | 93 |
| 84 #endif | 94 #endif |
| OLD | NEW |