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

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

Issue 2007473004: [Autofill] Migrate ContentAutofillDriver<-->AutofillAgent IPCs to mojo. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase only Created 4 years, 5 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 <memory> 9 #include <memory>
10 #include <vector> 10 #include <vector>
11 11
12 #include "base/macros.h" 12 #include "base/macros.h"
13 #include "components/autofill/content/public/interfaces/autofill_driver.mojom.h"
14 #include "components/autofill/content/renderer/autofill_agent.h"
13 #include "components/autofill/content/renderer/password_form_conversion_utils.h" 15 #include "components/autofill/content/renderer/password_form_conversion_utils.h"
14 #include "components/autofill/core/common/form_data_predictions.h" 16 #include "components/autofill/core/common/form_data_predictions.h"
15 #include "components/autofill/core/common/password_form_field_prediction_map.h" 17 #include "components/autofill/core/common/password_form_field_prediction_map.h"
16 #include "components/autofill/core/common/password_form_fill_data.h" 18 #include "components/autofill/core/common/password_form_fill_data.h"
17 #include "content/public/renderer/render_frame_observer.h" 19 #include "content/public/renderer/render_frame_observer.h"
18 #include "content/public/renderer/render_view_observer.h" 20 #include "content/public/renderer/render_view_observer.h"
19 #include "third_party/WebKit/public/web/WebInputElement.h" 21 #include "third_party/WebKit/public/web/WebInputElement.h"
20 22
21 namespace blink { 23 namespace blink {
22 class WebInputElement; 24 class WebInputElement;
23 class WebKeyboardEvent; 25 class WebKeyboardEvent;
24 class WebSecurityOrigin; 26 class WebSecurityOrigin;
25 } 27 }
26 28
27 namespace autofill { 29 namespace autofill {
28 30
29 class RendererSavePasswordProgressLogger; 31 class RendererSavePasswordProgressLogger;
30 32
31 // This class is responsible for filling password forms. 33 // This class is responsible for filling password forms.
32 class PasswordAutofillAgent : public content::RenderFrameObserver { 34 class PasswordAutofillAgent : public content::RenderFrameObserver {
33 public: 35 public:
34 explicit PasswordAutofillAgent(content::RenderFrame* render_frame); 36 explicit PasswordAutofillAgent(content::RenderFrame* render_frame);
35 ~PasswordAutofillAgent() override; 37 ~PasswordAutofillAgent() override;
36 38
39 void SetAutofillAgent(AutofillAgent* autofill_agent);
40
37 // WebFrameClient editor related calls forwarded by AutofillAgent. 41 // WebFrameClient editor related calls forwarded by AutofillAgent.
38 // If they return true, it indicates the event was consumed and should not 42 // If they return true, it indicates the event was consumed and should not
39 // be used for any other autofill activity. 43 // be used for any other autofill activity.
40 bool TextFieldDidEndEditing(const blink::WebInputElement& element); 44 bool TextFieldDidEndEditing(const blink::WebInputElement& element);
41 bool TextDidChangeInTextField(const blink::WebInputElement& element); 45 bool TextDidChangeInTextField(const blink::WebInputElement& element);
42 46
43 // Function that should be called whenever the value of |element| changes due 47 // Function that should be called whenever the value of |element| changes due
44 // to user input. This is separate from TextDidChangeInTextField() as that 48 // to user input. This is separate from TextDidChangeInTextField() as that
45 // function may trigger UI and should only be called when other UI won't be 49 // function may trigger UI and should only be called when other UI won't be
46 // shown. 50 // shown.
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 void ProvisionallySavePassword(std::unique_ptr<PasswordForm> password_form, 221 void ProvisionallySavePassword(std::unique_ptr<PasswordForm> password_form,
218 ProvisionallySaveRestriction restriction); 222 ProvisionallySaveRestriction restriction);
219 223
220 // Returns true if |provisionally_saved_form_| has enough information that 224 // Returns true if |provisionally_saved_form_| has enough information that
221 // it is likely filled out. 225 // it is likely filled out.
222 bool ProvisionallySavedPasswordIsValid(); 226 bool ProvisionallySavedPasswordIsValid();
223 227
224 // Helper function called when in-page navigation completed 228 // Helper function called when in-page navigation completed
225 void OnSamePageNavigationCompleted(); 229 void OnSamePageNavigationCompleted();
226 230
231 const mojom::AutofillDriverPtr& GetAutofillDriver();
232
227 // The logins we have filled so far with their associated info. 233 // The logins we have filled so far with their associated info.
228 WebInputToPasswordInfoMap web_input_to_password_info_; 234 WebInputToPasswordInfoMap web_input_to_password_info_;
229 // A (sort-of) reverse map to |login_to_password_info_|. 235 // A (sort-of) reverse map to |login_to_password_info_|.
230 PasswordToLoginMap password_to_username_; 236 PasswordToLoginMap password_to_username_;
231 237
232 // Set if the user might be submitting a password form on the current page, 238 // Set if the user might be submitting a password form on the current page,
233 // but the submit may still fail (i.e. doesn't pass JavaScript validation). 239 // but the submit may still fail (i.e. doesn't pass JavaScript validation).
234 std::unique_ptr<PasswordForm> provisionally_saved_form_; 240 std::unique_ptr<PasswordForm> provisionally_saved_form_;
235 241
236 // Contains the most recent text that user typed or PasswordManager autofilled 242 // Contains the most recent text that user typed or PasswordManager autofilled
(...skipping 11 matching lines...) Expand all
248 // True indicates that the password field was autofilled, false otherwise. 254 // True indicates that the password field was autofilled, false otherwise.
249 bool was_password_autofilled_; 255 bool was_password_autofilled_;
250 256
251 // Records the username typed before suggestions preview. 257 // Records the username typed before suggestions preview.
252 base::string16 username_query_prefix_; 258 base::string16 username_query_prefix_;
253 259
254 // Contains server predictions for username, password and/or new password 260 // Contains server predictions for username, password and/or new password
255 // fields for individual forms. 261 // fields for individual forms.
256 FormsPredictionsMap form_predictions_; 262 FormsPredictionsMap form_predictions_;
257 263
264 AutofillAgent* autofill_agent_; // Weak reference.
dcheng 2016/07/12 14:22:12 What's the lifetime relationship? Does AutofillAge
leonhsl(Using Gerrit) 2016/07/13 03:48:31 Both of them are observers of the same render fram
265
258 DISALLOW_COPY_AND_ASSIGN(PasswordAutofillAgent); 266 DISALLOW_COPY_AND_ASSIGN(PasswordAutofillAgent);
259 }; 267 };
260 268
261 } // namespace autofill 269 } // namespace autofill
262 270
263 #endif // COMPONENTS_AUTOFILL_CONTENT_RENDERER_PASSWORD_AUTOFILL_AGENT_H_ 271 #endif // COMPONENTS_AUTOFILL_CONTENT_RENDERER_PASSWORD_AUTOFILL_AGENT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698