OLD | NEW |
---|---|
(Empty) | |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef CHROME_BROWSER_AUTOFILL_PASSWORD_AUTOFILL_MANAGER_H_ | |
6 #define CHROME_BROWSER_AUTOFILL_PASSWORD_AUTOFILL_MANAGER_H_ | |
7 #pragma once | |
8 | |
9 // This file was contains some repeated code from | |
10 // chrome/renderer/autofill/password_autofill_manager because as we move to the | |
11 // new Autofill UI we needs these functions in both the browser and renderer. | |
12 // Once the move is completed the repeated code in the renderer half should be | |
13 // removed. | |
14 // http://crbug.com/51644 | |
15 | |
16 #include <map> | |
17 | |
18 #include "webkit/forms/password_form_dom_manager.h" | |
19 | |
20 class TabContentsWrapper; | |
21 | |
22 // This class is responsible for filling password forms. | |
23 // There is one PasswordAutofillManager per RenderView. | |
24 class PasswordAutofillManager { | |
25 public: | |
26 explicit PasswordAutofillManager(TabContentsWrapper* tab_contents_wrapper); | |
27 virtual ~PasswordAutofillManager(); | |
28 | |
29 // If this return true, it indicates the event would be consumed by the | |
30 // password manager in the renderer, so we shouldn't attempt to handle the | |
31 // key down, but instead pass it to the renderer. | |
32 bool WouldHandleKeyDown(const webkit::forms::FormField& field); | |
Ilya Sherman
2012/03/07 22:33:18
I didn't see any place where this method is used.
csharp
2012/03/08 16:48:37
I'll be using this when the keyboard cl lands (sho
Ilya Sherman
2012/03/08 23:22:14
Ok. In that case, I'd prefer to wait on committin
| |
33 | |
34 // Fills the password associated with user name |value|. Returns true if the | |
35 // username and password fields were filled, false otherwise. | |
36 bool DidAcceptAutofillSuggestion(const webkit::forms::FormField& field, | |
37 const string16& value); | |
38 | |
39 // A no-op. No filling happens for selection. But this method returns | |
40 // true when |node| is fillable by password Autofill. | |
41 bool DidSelectAutofillSuggestion(const webkit::forms::FormField& field); | |
42 | |
43 // A no-op. Password forms are not previewed, so they do not need to be | |
44 // cleared when the selection changes. However, this method returns | |
45 // true when |node| is fillable by password Autofill. | |
46 bool DidClearAutofillSelection(const webkit::forms::FormField& field); | |
47 | |
48 // Invoked when a password form is filled. | |
49 void FillPasswordForm(const webkit::forms::FormField& username_element, | |
50 const webkit::forms::PasswordFormFillData& form_data, | |
51 int frame_id); | |
52 | |
53 // Invoked when the passed frame is closing. Gives us a chance to clear any | |
54 // reference we may have to elements in that frame. | |
55 void FrameClosing(long long frame_id); | |
56 | |
57 private: | |
58 struct PasswordInfo { | |
59 long long frame_id; | |
60 webkit::forms::PasswordFormFillData fill_data; | |
61 }; | |
62 typedef std::map<webkit::forms::FormField, PasswordInfo> | |
63 LoginToPasswordInfoMap; | |
64 | |
65 bool WillFillUserNameAndPassword( | |
66 const webkit::forms::FormField& username_element, | |
67 const webkit::forms::PasswordFormFillData& fill_data); | |
68 | |
69 // Finds login information for a |node| that was previously filled. | |
70 bool FindLoginInfo(const webkit::forms::FormField& field, | |
71 webkit::forms::FormField* found_input, | |
72 PasswordInfo* found_password); | |
73 | |
74 // The logins we have filled so far with their associated info. | |
75 LoginToPasswordInfoMap login_to_password_info_; | |
76 | |
77 TabContentsWrapper* tab_contents_wrapper_; // Weak reference. | |
78 | |
79 DISALLOW_COPY_AND_ASSIGN(PasswordAutofillManager); | |
80 }; | |
81 | |
82 #endif // CHROME_BROWSER_AUTOFILL_PASSWORD_AUTOFILL_MANAGER_H_ | |
OLD | NEW |