| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
| 12 #include "base/gtest_prod_util.h" | 12 #include "base/gtest_prod_util.h" |
| 13 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
| 14 #include "chrome/renderer/autofill/form_cache.h" | 14 #include "chrome/renderer/autofill/form_cache.h" |
| 15 #include "chrome/renderer/page_click_listener.h" | 15 #include "chrome/renderer/page_click_listener.h" |
| 16 #include "content/public/renderer/render_view_observer.h" | 16 #include "content/public/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/WebInputElement.h" | 18 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputElement.h" |
| 19 | 19 |
| 20 namespace webkit { | 20 namespace chrome { |
| 21 namespace forms { | |
| 22 struct FormData; | 21 struct FormData; |
| 23 struct FormDataPredictions; | 22 struct FormDataPredictions; |
| 24 struct FormField; | 23 struct FormField; |
| 25 } | 24 } |
| 26 } | |
| 27 | 25 |
| 28 namespace WebKit { | 26 namespace WebKit { |
| 29 class WebNode; | 27 class WebNode; |
| 30 } | 28 } |
| 31 | 29 |
| 32 namespace autofill { | 30 namespace autofill { |
| 33 | 31 |
| 34 class PasswordAutofillManager; | 32 class PasswordAutofillManager; |
| 35 | 33 |
| 36 // AutofillAgent deals with Autofill related communications between WebKit and | 34 // AutofillAgent deals with Autofill related communications between WebKit and |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 93 const WebKit::WebInputElement& element) OVERRIDE; | 91 const WebKit::WebInputElement& element) OVERRIDE; |
| 94 virtual void textFieldDidReceiveKeyDown( | 92 virtual void textFieldDidReceiveKeyDown( |
| 95 const WebKit::WebInputElement& element, | 93 const WebKit::WebInputElement& element, |
| 96 const WebKit::WebKeyboardEvent& event) OVERRIDE; | 94 const WebKit::WebKeyboardEvent& event) OVERRIDE; |
| 97 | 95 |
| 98 void OnSuggestionsReturned(int query_id, | 96 void OnSuggestionsReturned(int query_id, |
| 99 const std::vector<string16>& values, | 97 const std::vector<string16>& values, |
| 100 const std::vector<string16>& labels, | 98 const std::vector<string16>& labels, |
| 101 const std::vector<string16>& icons, | 99 const std::vector<string16>& icons, |
| 102 const std::vector<int>& unique_ids); | 100 const std::vector<int>& unique_ids); |
| 103 void OnFormDataFilled(int query_id, const webkit::forms::FormData& form); | 101 void OnFormDataFilled(int query_id, const chrome::FormData& form); |
| 104 void OnFieldTypePredictionsAvailable( | 102 void OnFieldTypePredictionsAvailable( |
| 105 const std::vector<webkit::forms::FormDataPredictions>& forms); | 103 const std::vector<chrome::FormDataPredictions>& forms); |
| 106 | 104 |
| 107 // For external Autofill selection. | 105 // For external Autofill selection. |
| 108 void OnSelectAutofillSuggestionAtIndex(int listIndex); | 106 void OnSelectAutofillSuggestionAtIndex(int listIndex); |
| 109 void OnSetAutofillActionFill(); | 107 void OnSetAutofillActionFill(); |
| 110 void OnClearForm(); | 108 void OnClearForm(); |
| 111 void OnSetAutofillActionPreview(); | 109 void OnSetAutofillActionPreview(); |
| 112 void OnClearPreviewedForm(); | 110 void OnClearPreviewedForm(); |
| 113 void OnSetNodeText(const string16& value); | 111 void OnSetNodeText(const string16& value); |
| 114 void OnAcceptDataListSuggestion(const string16& value); | 112 void OnAcceptDataListSuggestion(const string16& value); |
| 115 void OnAcceptPasswordAutofillSuggestion(const string16& value); | 113 void OnAcceptPasswordAutofillSuggestion(const string16& value); |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 // profile's unique ID. |action| specifies whether to Fill or Preview the | 154 // profile's unique ID. |action| specifies whether to Fill or Preview the |
| 157 // values returned from the AutofillManager. | 155 // values returned from the AutofillManager. |
| 158 void FillAutofillFormData(const WebKit::WebNode& node, | 156 void FillAutofillFormData(const WebKit::WebNode& node, |
| 159 int unique_id, | 157 int unique_id, |
| 160 AutofillAction action); | 158 AutofillAction action); |
| 161 | 159 |
| 162 // Fills |form| and |field| with the FormData and FormField corresponding to | 160 // Fills |form| and |field| with the FormData and FormField corresponding to |
| 163 // |node|. Returns true if the data was found; and false otherwise. | 161 // |node|. Returns true if the data was found; and false otherwise. |
| 164 bool FindFormAndFieldForNode( | 162 bool FindFormAndFieldForNode( |
| 165 const WebKit::WebNode& node, | 163 const WebKit::WebNode& node, |
| 166 webkit::forms::FormData* form, | 164 chrome::FormData* form, |
| 167 webkit::forms::FormField* field) WARN_UNUSED_RESULT; | 165 chrome::FormField* field) WARN_UNUSED_RESULT; |
| 168 | 166 |
| 169 // Set |node| to display the given |value|. | 167 // Set |node| to display the given |value|. |
| 170 void SetNodeText(const string16& value, WebKit::WebInputElement* node); | 168 void SetNodeText(const string16& value, WebKit::WebInputElement* node); |
| 171 | 169 |
| 172 FormCache form_cache_; | 170 FormCache form_cache_; |
| 173 | 171 |
| 174 PasswordAutofillManager* password_autofill_manager_; // WEAK reference. | 172 PasswordAutofillManager* password_autofill_manager_; // WEAK reference. |
| 175 | 173 |
| 176 // The ID of the last request sent for form field Autofill. Used to ignore | 174 // The ID of the last request sent for form field Autofill. Used to ignore |
| 177 // out of date responses. | 175 // out of date responses. |
| (...skipping 26 matching lines...) Expand all Loading... |
| 204 FRIEND_TEST_ALL_PREFIXES(PasswordAutofillManagerTest, WaitUsername); | 202 FRIEND_TEST_ALL_PREFIXES(PasswordAutofillManagerTest, WaitUsername); |
| 205 FRIEND_TEST_ALL_PREFIXES(PasswordAutofillManagerTest, SuggestionAccept); | 203 FRIEND_TEST_ALL_PREFIXES(PasswordAutofillManagerTest, SuggestionAccept); |
| 206 FRIEND_TEST_ALL_PREFIXES(PasswordAutofillManagerTest, SuggestionSelect); | 204 FRIEND_TEST_ALL_PREFIXES(PasswordAutofillManagerTest, SuggestionSelect); |
| 207 | 205 |
| 208 DISALLOW_COPY_AND_ASSIGN(AutofillAgent); | 206 DISALLOW_COPY_AND_ASSIGN(AutofillAgent); |
| 209 }; | 207 }; |
| 210 | 208 |
| 211 } // namespace autofill | 209 } // namespace autofill |
| 212 | 210 |
| 213 #endif // CHROME_RENDERER_AUTOFILL_AUTOFILL_AGENT_H_ | 211 #endif // CHROME_RENDERER_AUTOFILL_AUTOFILL_AGENT_H_ |
| OLD | NEW |