OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 COMPONENTS_AUTOFILL_CONTENT_RENDERER_PASSWORD_AUTOFILL_AGENT_H_ | 5 #ifndef COMPONENTS_AUTOFILL_CONTENT_RENDERER_PASSWORD_AUTOFILL_AGENT_H_ |
6 #define COMPONENTS_AUTOFILL_CONTENT_RENDERER_PASSWORD_AUTOFILL_AGENT_H_ | 6 #define COMPONENTS_AUTOFILL_CONTENT_RENDERER_PASSWORD_AUTOFILL_AGENT_H_ |
7 | 7 |
8 #include <map> | 8 #include <map> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "base/gtest_prod_util.h" | 11 #include "base/gtest_prod_util.h" |
12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
13 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
| 14 #include "components/autofill/core/common/form_data_predictions.h" |
14 #include "components/autofill/core/common/password_form_fill_data.h" | 15 #include "components/autofill/core/common/password_form_fill_data.h" |
15 #include "content/public/renderer/render_frame_observer.h" | 16 #include "content/public/renderer/render_frame_observer.h" |
16 #include "content/public/renderer/render_view_observer.h" | 17 #include "content/public/renderer/render_view_observer.h" |
17 #include "third_party/WebKit/public/web/WebInputElement.h" | 18 #include "third_party/WebKit/public/web/WebInputElement.h" |
18 | 19 |
19 namespace blink { | 20 namespace blink { |
20 class WebInputElement; | 21 class WebInputElement; |
21 class WebKeyboardEvent; | 22 class WebKeyboardEvent; |
22 class WebSecurityOrigin; | 23 class WebSecurityOrigin; |
23 } | 24 } |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 bool backspace_pressed_last; | 96 bool backspace_pressed_last; |
96 // The user manually edited the password more recently than the username was | 97 // The user manually edited the password more recently than the username was |
97 // changed. | 98 // changed. |
98 bool password_was_edited_last; | 99 bool password_was_edited_last; |
99 PasswordInfo(); | 100 PasswordInfo(); |
100 }; | 101 }; |
101 typedef std::map<blink::WebInputElement, PasswordInfo> LoginToPasswordInfoMap; | 102 typedef std::map<blink::WebInputElement, PasswordInfo> LoginToPasswordInfoMap; |
102 typedef std::map<blink::WebElement, int> LoginToPasswordInfoKeyMap; | 103 typedef std::map<blink::WebElement, int> LoginToPasswordInfoKeyMap; |
103 typedef std::map<blink::WebInputElement, blink::WebInputElement> | 104 typedef std::map<blink::WebInputElement, blink::WebInputElement> |
104 PasswordToLoginMap; | 105 PasswordToLoginMap; |
| 106 std::vector<autofill::FormDataPredictions> form_predictions_; |
105 | 107 |
106 // This class keeps track of autofilled password input elements and makes sure | 108 // This class keeps track of autofilled password input elements and makes sure |
107 // the autofilled password value is not accessible to JavaScript code until | 109 // the autofilled password value is not accessible to JavaScript code until |
108 // the user interacts with the page. | 110 // the user interacts with the page. |
109 class PasswordValueGatekeeper { | 111 class PasswordValueGatekeeper { |
110 public: | 112 public: |
111 PasswordValueGatekeeper(); | 113 PasswordValueGatekeeper(); |
112 ~PasswordValueGatekeeper(); | 114 ~PasswordValueGatekeeper(); |
113 | 115 |
114 // Call this for every autofilled password field, so that the gatekeeper | 116 // Call this for every autofilled password field, so that the gatekeeper |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
166 void WillSubmitForm(const blink::WebFormElement& form) override; | 168 void WillSubmitForm(const blink::WebFormElement& form) override; |
167 | 169 |
168 // Legacy RenderViewObserver: | 170 // Legacy RenderViewObserver: |
169 void DidStartLoading(); | 171 void DidStartLoading(); |
170 void DidStopLoading(); | 172 void DidStopLoading(); |
171 void LegacyDidStartProvisionalLoad(blink::WebLocalFrame* frame); | 173 void LegacyDidStartProvisionalLoad(blink::WebLocalFrame* frame); |
172 | 174 |
173 // RenderView IPC handlers: | 175 // RenderView IPC handlers: |
174 void OnFillPasswordForm(int key, const PasswordFormFillData& form_data); | 176 void OnFillPasswordForm(int key, const PasswordFormFillData& form_data); |
175 void OnSetLoggingState(bool active); | 177 void OnSetLoggingState(bool active); |
| 178 void OnAutofillDataReceived( |
| 179 const std::vector<autofill::FormDataPredictions>& forms); |
176 | 180 |
177 // Scans the given frame for password forms and sends them up to the browser. | 181 // Scans the given frame for password forms and sends them up to the browser. |
178 // If |only_visible| is true, only forms visible in the layout are sent. | 182 // If |only_visible| is true, only forms visible in the layout are sent. |
179 void SendPasswordForms(bool only_visible); | 183 void SendPasswordForms(bool only_visible); |
180 | 184 |
181 // Instructs the browser to show a pop-up suggesting which credentials could | 185 // Instructs the browser to show a pop-up suggesting which credentials could |
182 // be filled. |show_in_password_field| should indicate whether the pop-up is | 186 // be filled. |show_in_password_field| should indicate whether the pop-up is |
183 // to be shown on the password field instead of on the username field. If the | 187 // to be shown on the password field instead of on the username field. If the |
184 // username exists, it should be passed as |user_input|. If there is no | 188 // username exists, it should be passed as |user_input|. If there is no |
185 // username, pass the password field in |user_input|. In the latter case, no | 189 // username, pass the password field in |user_input|. In the latter case, no |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
271 bool save_password_on_in_page_navigation_; | 275 bool save_password_on_in_page_navigation_; |
272 | 276 |
273 base::WeakPtrFactory<PasswordAutofillAgent> weak_ptr_factory_; | 277 base::WeakPtrFactory<PasswordAutofillAgent> weak_ptr_factory_; |
274 | 278 |
275 DISALLOW_COPY_AND_ASSIGN(PasswordAutofillAgent); | 279 DISALLOW_COPY_AND_ASSIGN(PasswordAutofillAgent); |
276 }; | 280 }; |
277 | 281 |
278 } // namespace autofill | 282 } // namespace autofill |
279 | 283 |
280 #endif // COMPONENTS_AUTOFILL_CONTENT_RENDERER_PASSWORD_AUTOFILL_AGENT_H_ | 284 #endif // COMPONENTS_AUTOFILL_CONTENT_RENDERER_PASSWORD_AUTOFILL_AGENT_H_ |
OLD | NEW |