Chromium Code Reviews| 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_RENDERER_AUTOFILL_AUTOFILL_AGENT_H_ | 5 #ifndef CHROME_RENDERER_AUTOFILL_AUTOFILL_AGENT_H_ |
| 6 #define CHROME_RENDERER_AUTOFILL_AUTOFILL_AGENT_H_ | 6 #define CHROME_RENDERER_AUTOFILL_AUTOFILL_AGENT_H_ |
| 7 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
| 12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
| 13 #include "base/task.h" | 13 #include "base/task.h" |
| 14 #include "chrome/renderer/autofill/form_manager.h" | 14 #include "chrome/renderer/autofill/form_manager.h" |
| 15 #include "chrome/renderer/page_click_listener.h" | 15 #include "chrome/renderer/page_click_listener.h" |
| 16 #include "content/renderer/render_view_observer.h" | 16 #include "content/renderer/render_view_observer.h" |
| 17 #include "third_party/WebKit/Source/WebKit/chromium/public/WebAutofillClient.h" | 17 #include "third_party/WebKit/Source/WebKit/chromium/public/WebAutofillClient.h" |
| 18 #include "third_party/WebKit/Source/WebKit/chromium/public/WebNode.h" | 18 #include "third_party/WebKit/Source/WebKit/chromium/public/WebNode.h" |
| 19 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputElement.h" | |
| 19 #include "webkit/glue/form_data.h" | 20 #include "webkit/glue/form_data.h" |
| 20 #include "webkit/glue/form_field.h" | 21 #include "webkit/glue/form_field.h" |
| 21 | 22 |
| 22 namespace webkit_glue { | 23 namespace webkit_glue { |
| 23 struct FormDataPredictions; | 24 struct FormDataPredictions; |
| 24 } | 25 } |
| 25 | 26 |
| 26 namespace autofill { | 27 namespace autofill { |
| 27 | 28 |
| 28 class PasswordAutofillManager; | 29 class PasswordAutofillManager; |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 110 // |display_warning_if_disabled| specifies whether a warning should be | 111 // |display_warning_if_disabled| specifies whether a warning should be |
| 111 // displayed to the user if Autofill has suggestions available, but cannot | 112 // displayed to the user if Autofill has suggestions available, but cannot |
| 112 // fill them because it is disabled (e.g. when trying to fill a credit card | 113 // fill them because it is disabled (e.g. when trying to fill a credit card |
| 113 // form on a non-secure website). | 114 // form on a non-secure website). |
| 114 void ShowSuggestions(const WebKit::WebInputElement& element, | 115 void ShowSuggestions(const WebKit::WebInputElement& element, |
| 115 bool autofill_on_empty_values, | 116 bool autofill_on_empty_values, |
| 116 bool requires_caret_at_end, | 117 bool requires_caret_at_end, |
| 117 bool display_warning_if_disabled); | 118 bool display_warning_if_disabled); |
| 118 | 119 |
| 119 // Queries the browser for Autocomplete and Autofill suggestions for the given | 120 // Queries the browser for Autocomplete and Autofill suggestions for the given |
| 120 // |node|. | 121 // |element|. |
| 121 void QueryAutofillSuggestions(const WebKit::WebNode& node, | 122 void QueryAutofillSuggestions(const WebKit::WebInputElement& element, |
| 122 bool display_warning_if_disabled); | 123 bool display_warning_if_disabled); |
| 123 | 124 |
| 124 // Queries the AutofillManager for form data for the form containing |node|. | 125 // Queries the AutofillManager for form data for the form containing |node|. |
| 125 // |value| is the current text in the field, and |unique_id| is the selected | 126 // |value| is the current text in the field, and |unique_id| is the selected |
| 126 // profile's unique ID. |action| specifies whether to Fill or Preview the | 127 // profile's unique ID. |action| specifies whether to Fill or Preview the |
| 127 // values returned from the AutofillManager. | 128 // values returned from the AutofillManager. |
| 128 void FillAutofillFormData(const WebKit::WebNode& node, | 129 void FillAutofillFormData(const WebKit::WebNode& node, |
| 129 int unique_id, | 130 int unique_id, |
| 130 AutofillAction action); | 131 AutofillAction action); |
| 131 | 132 |
| 132 // Fills |form| and |field| with the FormData and FormField corresponding to | 133 // Fills |form| and |field| with the FormData and FormField corresponding to |
| 133 // |node|. Returns true if the data was found; and false otherwise. | 134 // |node|. Returns true if the data was found; and false otherwise. |
| 134 bool FindFormAndFieldForNode( | 135 bool FindFormAndFieldForNode( |
| 135 const WebKit::WebNode& node, | 136 const WebKit::WebNode& node, |
| 136 webkit_glue::FormData* form, | 137 webkit_glue::FormData* form, |
| 137 webkit_glue::FormField* field) WARN_UNUSED_RESULT; | 138 webkit_glue::FormField* field) WARN_UNUSED_RESULT; |
| 138 | 139 |
| 139 FormManager form_manager_; | 140 FormManager form_manager_; |
| 140 | 141 |
| 141 PasswordAutofillManager* password_autofill_manager_; | 142 PasswordAutofillManager* password_autofill_manager_; |
| 142 | 143 |
| 143 // The ID of the last request sent for form field Autofill. Used to ignore | 144 // The ID of the last request sent for form field Autofill. Used to ignore |
| 144 // out of date responses. | 145 // out of date responses. |
| 145 int autofill_query_id_; | 146 int autofill_query_id_; |
| 146 | 147 |
| 147 // The node corresponding to the last request sent for form field Autofill. | 148 // The node corresponding to the last request sent for form field Autofill. |
| 148 WebKit::WebNode autofill_query_node_; | 149 WebKit::WebInputElement autofill_query_node_; |
|
Ilya Sherman
2011/07/28 06:15:00
nit: We should probably also rename |autofill_quer
honten.org
2011/07/28 06:30:53
Done.
| |
| 149 | 150 |
| 150 // The action to take when receiving Autofill data from the AutofillManager. | 151 // The action to take when receiving Autofill data from the AutofillManager. |
| 151 AutofillAction autofill_action_; | 152 AutofillAction autofill_action_; |
| 152 | 153 |
| 153 // Should we display a warning if autofill is disabled? | 154 // Should we display a warning if autofill is disabled? |
| 154 bool display_warning_if_disabled_; | 155 bool display_warning_if_disabled_; |
| 155 | 156 |
| 156 // Was the query node autofilled prior to previewing the form? | 157 // Was the query node autofilled prior to previewing the form? |
| 157 bool was_query_node_autofilled_; | 158 bool was_query_node_autofilled_; |
| 158 | 159 |
| 159 // The menu index of the "Clear" menu item. | 160 // The menu index of the "Clear" menu item. |
| 160 int suggestions_clear_index_; | 161 int suggestions_clear_index_; |
| 161 | 162 |
| 162 // The menu index of the "Autofill options..." menu item. | 163 // The menu index of the "Autofill options..." menu item. |
| 163 int suggestions_options_index_; | 164 int suggestions_options_index_; |
| 164 | 165 |
| 165 ScopedRunnableMethodFactory<AutofillAgent> method_factory_; | 166 ScopedRunnableMethodFactory<AutofillAgent> method_factory_; |
| 166 | 167 |
| 167 DISALLOW_COPY_AND_ASSIGN(AutofillAgent); | 168 DISALLOW_COPY_AND_ASSIGN(AutofillAgent); |
| 168 }; | 169 }; |
| 169 | 170 |
| 170 } // namespace autofill | 171 } // namespace autofill |
| 171 | 172 |
| 172 #endif // CHROME_RENDERER_AUTOFILL_AUTOFILL_AGENT_H_ | 173 #endif // CHROME_RENDERER_AUTOFILL_AUTOFILL_AGENT_H_ |
| OLD | NEW |