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