Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(93)

Side by Side Diff: components/autofill/content/renderer/password_autofill_agent.h

Issue 1153023004: Prepare the infrastructure for password overrides. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixed the test. Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/form_data_predictions.h"
15 #include "components/autofill/core/common/password_form_field_prediction_map.h"
15 #include "components/autofill/core/common/password_form_fill_data.h" 16 #include "components/autofill/core/common/password_form_fill_data.h"
16 #include "content/public/renderer/render_frame_observer.h" 17 #include "content/public/renderer/render_frame_observer.h"
17 #include "content/public/renderer/render_view_observer.h" 18 #include "content/public/renderer/render_view_observer.h"
18 #include "third_party/WebKit/public/web/WebInputElement.h" 19 #include "third_party/WebKit/public/web/WebInputElement.h"
19 20
20 namespace blink { 21 namespace blink {
21 class WebInputElement; 22 class WebInputElement;
22 class WebKeyboardEvent; 23 class WebKeyboardEvent;
23 class WebSecurityOrigin; 24 class WebSecurityOrigin;
24 } 25 }
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 bool backspace_pressed_last; 101 bool backspace_pressed_last;
101 // The user manually edited the password more recently than the username was 102 // The user manually edited the password more recently than the username was
102 // changed. 103 // changed.
103 bool password_was_edited_last; 104 bool password_was_edited_last;
104 PasswordInfo(); 105 PasswordInfo();
105 }; 106 };
106 typedef std::map<blink::WebInputElement, PasswordInfo> LoginToPasswordInfoMap; 107 typedef std::map<blink::WebInputElement, PasswordInfo> LoginToPasswordInfoMap;
107 typedef std::map<blink::WebElement, int> LoginToPasswordInfoKeyMap; 108 typedef std::map<blink::WebElement, int> LoginToPasswordInfoKeyMap;
108 typedef std::map<blink::WebInputElement, blink::WebInputElement> 109 typedef std::map<blink::WebInputElement, blink::WebInputElement>
109 PasswordToLoginMap; 110 PasswordToLoginMap;
110 using FormDataFieldDataMap = 111 using FormsPredictionsMap =
111 std::map<autofill::FormData, autofill::FormFieldData>; 112 std::map<autofill::FormData, autofill::PasswordFormFieldPredictionMap>;
112 113
113 // This class keeps track of autofilled password input elements and makes sure 114 // This class keeps track of autofilled password input elements and makes sure
114 // the autofilled password value is not accessible to JavaScript code until 115 // the autofilled password value is not accessible to JavaScript code until
115 // the user interacts with the page. 116 // the user interacts with the page.
116 class PasswordValueGatekeeper { 117 class PasswordValueGatekeeper {
117 public: 118 public:
118 PasswordValueGatekeeper(); 119 PasswordValueGatekeeper();
119 ~PasswordValueGatekeeper(); 120 ~PasswordValueGatekeeper();
120 121
121 // Call this for every autofilled password field, so that the gatekeeper 122 // Call this for every autofilled password field, so that the gatekeeper
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 void WillSubmitForm(const blink::WebFormElement& form) override; 174 void WillSubmitForm(const blink::WebFormElement& form) override;
174 175
175 // Legacy RenderViewObserver: 176 // Legacy RenderViewObserver:
176 void DidStartLoading(); 177 void DidStartLoading();
177 void DidStopLoading(); 178 void DidStopLoading();
178 void LegacyDidStartProvisionalLoad(blink::WebLocalFrame* frame); 179 void LegacyDidStartProvisionalLoad(blink::WebLocalFrame* frame);
179 180
180 // RenderView IPC handlers: 181 // RenderView IPC handlers:
181 void OnFillPasswordForm(int key, const PasswordFormFillData& form_data); 182 void OnFillPasswordForm(int key, const PasswordFormFillData& form_data);
182 void OnSetLoggingState(bool active); 183 void OnSetLoggingState(bool active);
183 void OnAutofillUsernameDataReceived(const FormDataFieldDataMap& predictions); 184 void OnAutofillUsernameAndPasswordDataReceived(
185 const FormsPredictionsMap& predictions);
184 186
185 // Scans the given frame for password forms and sends them up to the browser. 187 // Scans the given frame for password forms and sends them up to the browser.
186 // If |only_visible| is true, only forms visible in the layout are sent. 188 // If |only_visible| is true, only forms visible in the layout are sent.
187 void SendPasswordForms(bool only_visible); 189 void SendPasswordForms(bool only_visible);
188 190
189 // Instructs the browser to show a pop-up suggesting which credentials could 191 // Instructs the browser to show a pop-up suggesting which credentials could
190 // be filled. |show_in_password_field| should indicate whether the pop-up is 192 // be filled. |show_in_password_field| should indicate whether the pop-up is
191 // to be shown on the password field instead of on the username field. If the 193 // to be shown on the password field instead of on the username field. If the
192 // username exists, it should be passed as |user_input|. If there is no 194 // username exists, it should be passed as |user_input|. If there is no
193 // username, pass the password field in |user_input|. In the latter case, no 195 // username, pass the password field in |user_input|. In the latter case, no
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
275 // before preview. 277 // before preview.
276 int username_selection_start_; 278 int username_selection_start_;
277 279
278 // True indicates that all frames in a page have been rendered. 280 // True indicates that all frames in a page have been rendered.
279 bool did_stop_loading_; 281 bool did_stop_loading_;
280 282
281 // True indicates that there is a command line flag to enable showing of 283 // True indicates that there is a command line flag to enable showing of
282 // save password prompt on in-page navigations. 284 // save password prompt on in-page navigations.
283 bool save_password_on_in_page_navigation_; 285 bool save_password_on_in_page_navigation_;
284 286
285 // Contains server predictions for which field is the username field for forms 287 // Contains server predictions for username, password and/or new password
286 // on the page. 288 // fields for individual forms.
287 FormDataFieldDataMap form_predictions_; 289 FormsPredictionsMap form_predictions_;
288 290
289 base::WeakPtrFactory<PasswordAutofillAgent> weak_ptr_factory_; 291 base::WeakPtrFactory<PasswordAutofillAgent> weak_ptr_factory_;
290 292
291 DISALLOW_COPY_AND_ASSIGN(PasswordAutofillAgent); 293 DISALLOW_COPY_AND_ASSIGN(PasswordAutofillAgent);
292 }; 294 };
293 295
294 } // namespace autofill 296 } // namespace autofill
295 297
296 #endif // COMPONENTS_AUTOFILL_CONTENT_RENDERER_PASSWORD_AUTOFILL_AGENT_H_ 298 #endif // COMPONENTS_AUTOFILL_CONTENT_RENDERER_PASSWORD_AUTOFILL_AGENT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698