| 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/gtest_prod_util.h" | 13 #include "base/gtest_prod_util.h" |
| 14 #include "base/memory/weak_ptr.h" | 14 #include "base/memory/weak_ptr.h" |
| 15 #include "chrome/renderer/autofill/form_cache.h" | 15 #include "chrome/renderer/autofill/form_cache.h" |
| 16 #include "chrome/renderer/page_click_listener.h" | 16 #include "chrome/renderer/page_click_listener.h" |
| 17 #include "content/public/renderer/render_view_observer.h" | 17 #include "content/public/renderer/render_view_observer.h" |
| 18 #include "third_party/WebKit/Source/WebKit/chromium/public/WebAutofillClient.h" | 18 #include "third_party/WebKit/Source/WebKit/chromium/public/WebAutofillClient.h" |
| 19 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputElement.h" | 19 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputElement.h" |
| 20 | 20 |
| 21 namespace webkit_glue { | 21 namespace webkit { |
| 22 namespace forms { |
| 22 struct FormData; | 23 struct FormData; |
| 23 struct FormDataPredictions; | 24 struct FormDataPredictions; |
| 24 struct FormField; | 25 struct FormField; |
| 25 } | 26 } |
| 27 } |
| 26 | 28 |
| 27 namespace WebKit { | 29 namespace WebKit { |
| 28 class WebNode; | 30 class WebNode; |
| 29 } | 31 } |
| 30 | 32 |
| 31 namespace autofill { | 33 namespace autofill { |
| 32 | 34 |
| 33 class PasswordAutofillManager; | 35 class PasswordAutofillManager; |
| 34 | 36 |
| 35 // AutofillAgent deals with Autofill related communications between WebKit and | 37 // AutofillAgent deals with Autofill related communications between WebKit and |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 const WebKit::WebInputElement& element) OVERRIDE; | 92 const WebKit::WebInputElement& element) OVERRIDE; |
| 91 virtual void textFieldDidReceiveKeyDown( | 93 virtual void textFieldDidReceiveKeyDown( |
| 92 const WebKit::WebInputElement& element, | 94 const WebKit::WebInputElement& element, |
| 93 const WebKit::WebKeyboardEvent& event) OVERRIDE; | 95 const WebKit::WebKeyboardEvent& event) OVERRIDE; |
| 94 | 96 |
| 95 void OnSuggestionsReturned(int query_id, | 97 void OnSuggestionsReturned(int query_id, |
| 96 const std::vector<string16>& values, | 98 const std::vector<string16>& values, |
| 97 const std::vector<string16>& labels, | 99 const std::vector<string16>& labels, |
| 98 const std::vector<string16>& icons, | 100 const std::vector<string16>& icons, |
| 99 const std::vector<int>& unique_ids); | 101 const std::vector<int>& unique_ids); |
| 100 void OnFormDataFilled(int query_id, const webkit_glue::FormData& form); | 102 void OnFormDataFilled(int query_id, const webkit::forms::FormData& form); |
| 101 void OnFieldTypePredictionsAvailable( | 103 void OnFieldTypePredictionsAvailable( |
| 102 const std::vector<webkit_glue::FormDataPredictions>& forms); | 104 const std::vector<webkit::forms::FormDataPredictions>& forms); |
| 103 | 105 |
| 104 // For external Autofill selection. | 106 // For external Autofill selection. |
| 105 void OnSelectAutofillSuggestionAtIndex(int listIndex); | 107 void OnSelectAutofillSuggestionAtIndex(int listIndex); |
| 106 | 108 |
| 107 // Called in a posted task by textFieldDidChange() to work-around a WebKit bug | 109 // Called in a posted task by textFieldDidChange() to work-around a WebKit bug |
| 108 // http://bugs.webkit.org/show_bug.cgi?id=16976 | 110 // http://bugs.webkit.org/show_bug.cgi?id=16976 |
| 109 void TextFieldDidChangeImpl(const WebKit::WebInputElement& element); | 111 void TextFieldDidChangeImpl(const WebKit::WebInputElement& element); |
| 110 | 112 |
| 111 // Shows the autofill suggestions for |element|. | 113 // Shows the autofill suggestions for |element|. |
| 112 // This call is asynchronous and may or may not lead to the showing of a | 114 // This call is asynchronous and may or may not lead to the showing of a |
| (...skipping 21 matching lines...) Expand all Loading... |
| 134 // profile's unique ID. |action| specifies whether to Fill or Preview the | 136 // profile's unique ID. |action| specifies whether to Fill or Preview the |
| 135 // values returned from the AutofillManager. | 137 // values returned from the AutofillManager. |
| 136 void FillAutofillFormData(const WebKit::WebNode& node, | 138 void FillAutofillFormData(const WebKit::WebNode& node, |
| 137 int unique_id, | 139 int unique_id, |
| 138 AutofillAction action); | 140 AutofillAction action); |
| 139 | 141 |
| 140 // Fills |form| and |field| with the FormData and FormField corresponding to | 142 // Fills |form| and |field| with the FormData and FormField corresponding to |
| 141 // |node|. Returns true if the data was found; and false otherwise. | 143 // |node|. Returns true if the data was found; and false otherwise. |
| 142 bool FindFormAndFieldForNode( | 144 bool FindFormAndFieldForNode( |
| 143 const WebKit::WebNode& node, | 145 const WebKit::WebNode& node, |
| 144 webkit_glue::FormData* form, | 146 webkit::forms::FormData* form, |
| 145 webkit_glue::FormField* field) WARN_UNUSED_RESULT; | 147 webkit::forms::FormField* field) WARN_UNUSED_RESULT; |
| 146 | 148 |
| 147 FormCache form_cache_; | 149 FormCache form_cache_; |
| 148 | 150 |
| 149 PasswordAutofillManager* password_autofill_manager_; // WEAK reference. | 151 PasswordAutofillManager* password_autofill_manager_; // WEAK reference. |
| 150 | 152 |
| 151 // The ID of the last request sent for form field Autofill. Used to ignore | 153 // The ID of the last request sent for form field Autofill. Used to ignore |
| 152 // out of date responses. | 154 // out of date responses. |
| 153 int autofill_query_id_; | 155 int autofill_query_id_; |
| 154 | 156 |
| 155 // The element corresponding to the last request sent for form field Autofill. | 157 // The element corresponding to the last request sent for form field Autofill. |
| (...skipping 26 matching lines...) Expand all Loading... |
| 182 FRIEND_TEST_ALL_PREFIXES(PasswordAutofillManagerTest, WaitUsername); | 184 FRIEND_TEST_ALL_PREFIXES(PasswordAutofillManagerTest, WaitUsername); |
| 183 FRIEND_TEST_ALL_PREFIXES(PasswordAutofillManagerTest, SuggestionAccept); | 185 FRIEND_TEST_ALL_PREFIXES(PasswordAutofillManagerTest, SuggestionAccept); |
| 184 FRIEND_TEST_ALL_PREFIXES(PasswordAutofillManagerTest, SuggestionSelect); | 186 FRIEND_TEST_ALL_PREFIXES(PasswordAutofillManagerTest, SuggestionSelect); |
| 185 | 187 |
| 186 DISALLOW_COPY_AND_ASSIGN(AutofillAgent); | 188 DISALLOW_COPY_AND_ASSIGN(AutofillAgent); |
| 187 }; | 189 }; |
| 188 | 190 |
| 189 } // namespace autofill | 191 } // namespace autofill |
| 190 | 192 |
| 191 #endif // CHROME_RENDERER_AUTOFILL_AUTOFILL_AGENT_H_ | 193 #endif // CHROME_RENDERER_AUTOFILL_AUTOFILL_AGENT_H_ |
| OLD | NEW |