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. |
34 virtual void OnQuery(int query_id, | 38 virtual void OnQuery(int query_id, |
35 const webkit_glue::FormData& form, | 39 const webkit_glue::FormData& form, |
36 const webkit_glue::FormField& field) = 0; | 40 const webkit_glue::FormField& field) = 0; |
37 | 41 |
38 // Records query results. Displays them to the user with an external | 42 // Records query results. Displays them to the user with an external |
39 // Autofill popup that lives completely in the browser. Called when | 43 // Autofill popup that lives completely in the browser. Called when |
40 // an Autofill query result is available. | 44 // an Autofill query result is available. |
45 // TODO(csharp): This should contain the logic found in | |
46 // AutofillAgent::OnSuggestionsReturned. | |
Ilya Sherman
2011/11/09 20:34:19
nit: Please add a link to http://crbug.com/51644 h
csharp
2011/11/10 18:09:32
Done.
| |
41 virtual void OnSuggestionsReturned( | 47 virtual void OnSuggestionsReturned( |
42 int query_id, | 48 int query_id, |
43 const std::vector<string16>& autofill_values, | 49 const std::vector<string16>& autofill_values, |
44 const std::vector<string16>& autofill_labels, | 50 const std::vector<string16>& autofill_labels, |
45 const std::vector<string16>& autofill_icons, | 51 const std::vector<string16>& autofill_icons, |
46 const std::vector<int>& autofill_unique_ids) = 0; | 52 const std::vector<int>& autofill_unique_ids) = 0; |
47 | 53 |
54 // Set the bounds of the element we are providing the Autofill data | |
55 // for. The bounds are page-relative. | |
Ilya Sherman
2011/11/09 20:34:19
nit: Two spaces after a sentence-final period, ple
csharp
2011/11/10 18:09:32
Done.
What is the reason for the two spaces? I do
Ilya Sherman
2011/11/10 21:19:41
Yeah, it's not defined one way or the other in the
| |
56 virtual void SetAutofillElementBounds(const gfx::Rect& bounds) = 0; | |
57 | |
58 // Hide the Autofill poup. | |
59 virtual void HideAutofillPopup() = 0; | |
60 | |
48 // Platforms that wish to implement an external Autofill delegate | 61 // Platforms that wish to implement an external Autofill delegate |
49 // MUST implement this. The 1st arg is the tab contents that owns | 62 // MUST implement this. The 1st arg is the tab contents that owns |
50 // this delegate; the second is the Autofill manager owned by the | 63 // this delegate; the second is the Autofill manager owned by the |
51 // tab contents. | 64 // tab contents. |
52 static AutofillExternalDelegate* Create(TabContentsWrapper*, | 65 static AutofillExternalDelegate* Create(TabContentsWrapper*, |
53 AutofillManager*); | 66 AutofillManager*); |
54 | 67 |
55 protected: | 68 protected: |
56 explicit AutofillExternalDelegate(TabContentsWrapper* tab_contents_wrapper); | 69 explicit AutofillExternalDelegate(TabContentsWrapper* tab_contents_wrapper); |
57 | 70 |
58 private: | 71 private: |
59 TabContentsWrapper* tab_contents_wrapper_; // weak; owns me. | 72 TabContentsWrapper* tab_contents_wrapper_; // weak; owns me. |
60 | 73 |
61 DISALLOW_COPY_AND_ASSIGN(AutofillExternalDelegate); | 74 DISALLOW_COPY_AND_ASSIGN(AutofillExternalDelegate); |
62 }; | 75 }; |
63 | 76 |
64 #endif // CHROME_BROWSER_AUTOFILL_AUTOFILL_EXTERNAL_DELEGATE_H_ | 77 #endif // CHROME_BROWSER_AUTOFILL_AUTOFILL_EXTERNAL_DELEGATE_H_ |
OLD | NEW |