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

Side by Side Diff: components/autofill/core/browser/password_autofill_manager.h

Issue 79103002: Abstracted AcceptPasswordAutofillSuggestion IPC out of core Autofill code. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Review fixes. Created 7 years, 1 month 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_CORE_BROWSER_PASSWORD_AUTOFILL_MANAGER_H_ 5 #ifndef COMPONENTS_AUTOFILL_CORE_BROWSER_PASSWORD_AUTOFILL_MANAGER_H_
6 #define COMPONENTS_AUTOFILL_CORE_BROWSER_PASSWORD_AUTOFILL_MANAGER_H_ 6 #define COMPONENTS_AUTOFILL_CORE_BROWSER_PASSWORD_AUTOFILL_MANAGER_H_
7 7
8 // This file was contains some repeated code from 8 // This file was contains some repeated code from
9 // chrome/renderer/autofill/password_autofill_manager because as we move to the 9 // chrome/renderer/autofill/password_autofill_manager because as we move to the
10 // new Autofill UI we needs these functions in both the browser and renderer. 10 // new Autofill UI we needs these functions in both the browser and renderer.
11 // Once the move is completed the repeated code in the renderer half should be 11 // Once the move is completed the repeated code in the renderer half should be
12 // removed. 12 // removed.
13 // http://crbug.com/51644 13 // http://crbug.com/51644
14 14
15 #include <map> 15 #include <map>
16 16
17 #include "components/autofill/core/common/password_form_fill_data.h" 17 #include "components/autofill/core/common/password_form_fill_data.h"
18 18
19 namespace content { 19 namespace autofill {
20 class WebContents;
21 } // namespace content
22 20
23 namespace autofill { 21 class AutofillDriver;
24 22
25 // This class is responsible for filling password forms. 23 // This class is responsible for filling password forms.
26 class PasswordAutofillManager { 24 class PasswordAutofillManager {
27 public: 25 public:
28 explicit PasswordAutofillManager(content::WebContents* web_contents); 26 explicit PasswordAutofillManager(AutofillDriver* autofill_driver);
29 virtual ~PasswordAutofillManager(); 27 virtual ~PasswordAutofillManager();
30 28
31 // Fills the password associated with user name |value|. Returns true if the 29 // Fills the password associated with user name |username|. Returns true if
32 // username and password fields were filled, false otherwise. 30 // the username and password fields were filled, false otherwise.
33 bool DidAcceptAutofillSuggestion(const FormFieldData& field, 31 bool DidAcceptAutofillSuggestion(const FormFieldData& field,
34 const base::string16& value); 32 const base::string16& username);
35 33
36 // Invoked when a password mapping is added. 34 // Invoked when a password mapping is added.
37 void AddPasswordFormMapping( 35 void AddPasswordFormMapping(
38 const FormFieldData& username_element, 36 const FormFieldData& username_element,
39 const PasswordFormFillData& password); 37 const PasswordFormFillData& password);
40 38
41 // Invoked to clear any page specific cached values. 39 // Invoked to clear any page specific cached values.
42 void Reset(); 40 void Reset();
43 41
44 private: 42 private:
(...skipping 10 matching lines...) Expand all
55 const base::string16& current_username, 53 const base::string16& current_username,
56 const PasswordFormFillData& password); 54 const PasswordFormFillData& password);
57 55
58 // Finds login information for a |node| that was previously filled. 56 // Finds login information for a |node| that was previously filled.
59 bool FindLoginInfo(const FormFieldData& field, 57 bool FindLoginInfo(const FormFieldData& field,
60 PasswordFormFillData* found_password); 58 PasswordFormFillData* found_password);
61 59
62 // The logins we have filled so far with their associated info. 60 // The logins we have filled so far with their associated info.
63 LoginToPasswordInfoMap login_to_password_info_; 61 LoginToPasswordInfoMap login_to_password_info_;
64 62
65 // We only need the RenderViewHost pointer in WebContents, but if we attempt 63 // Provides driver-level context to the shared code of the component. Must
66 // to just store RenderViewHost on creation, it becomes invalid once we start 64 // outlive |this|.
67 // using it. By having the WebContents we can always get a valid pointer. 65 AutofillDriver* const autofill_driver_; // weak
68 content::WebContents* web_contents_; // Weak reference.
69 66
70 DISALLOW_COPY_AND_ASSIGN(PasswordAutofillManager); 67 DISALLOW_COPY_AND_ASSIGN(PasswordAutofillManager);
71 }; 68 };
72 69
73 } // namespace autofill 70 } // namespace autofill
74 71
75 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_PASSWORD_AUTOFILL_MANAGER_H_ 72 #endif // COMPONENTS_AUTOFILL_CORE_BROWSER_PASSWORD_AUTOFILL_MANAGER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698