OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2011 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 CHROME_BROWSER_AUTOFILL_AUTOFILL_EXTERNAL_DELEGATE_H_ |
| 6 #define CHROME_BROWSER_AUTOFILL_AUTOFILL_EXTERNAL_DELEGATE_H_ |
| 7 #pragma once |
| 8 |
| 9 #include <vector> |
| 10 |
| 11 #include "base/string16.h" |
| 12 |
| 13 class AutofillManager; |
| 14 class TabContentsWrapper; |
| 15 |
| 16 namespace webkit_glue { |
| 17 struct FormData; |
| 18 struct FormField; |
| 19 } // namespace webkit_glue |
| 20 |
| 21 // Delegate for external processing of Autocomplete and Autofill |
| 22 // display and selection. |
| 23 class AutofillExternalDelegate { |
| 24 public: |
| 25 virtual ~AutofillExternalDelegate(); |
| 26 |
| 27 // When using an external Autofill delegate. Allows Chrome to tell |
| 28 // WebKit which Autofill selection has been chosen. |
| 29 // TODO(jrg): add feedback mechanism for hover on relevant platforms. |
| 30 void SelectAutofillSuggestionAtIndex(int listIndex); |
| 31 |
| 32 // Records and associates a query_id with web form data. Called |
| 33 // when the renderer posts an Autofill query to the browser. |
| 34 virtual void OnQuery(int query_id, |
| 35 const webkit_glue::FormData& form, |
| 36 const webkit_glue::FormField& field) = 0; |
| 37 |
| 38 // Records query results. Displays them to the user with an external |
| 39 // Autofill popup that lives completely in the browser. Called when |
| 40 // an Autofill query result is available. |
| 41 virtual void OnSuggestionsReturned( |
| 42 int query_id, |
| 43 const std::vector<string16>& autofill_values, |
| 44 const std::vector<string16>& autofill_labels, |
| 45 const std::vector<string16>& autofill_icons, |
| 46 const std::vector<int>& autofill_unique_ids) = 0; |
| 47 |
| 48 // Platforms that wish to implement an external Autofill delegate |
| 49 // MUST implement this. The 1st arg is the tab contents that owns |
| 50 // this delegate; the second is the Autofill manager owned by the |
| 51 // tab contents. |
| 52 static AutofillExternalDelegate* Create(TabContentsWrapper*, |
| 53 AutofillManager*); |
| 54 |
| 55 protected: |
| 56 explicit AutofillExternalDelegate(TabContentsWrapper* tab_contents_wrapper); |
| 57 |
| 58 private: |
| 59 TabContentsWrapper* tab_contents_wrapper_; // weak; owns me. |
| 60 |
| 61 DISALLOW_COPY_AND_ASSIGN(AutofillExternalDelegate); |
| 62 }; |
| 63 |
| 64 #endif // CHROME_BROWSER_AUTOFILL_AUTOFILL_EXTERNAL_DELEGATE_H_ |
OLD | NEW |