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 render half should be | |
Ilya Sherman
2012/03/06 20:32:44
nit: "render" -> "renderer". Also, please annotat
csharp
2012/03/07 15:49:16
Done.
| |
13 // removed. | |
14 | |
15 #include <map> | |
16 | |
17 #include "webkit/forms/password_form_dom_manager.h" | |
18 | |
19 class TabContentsWrapper; | |
20 | |
21 // This class is responsible for filling password forms. | |
22 // There is one PasswordAutofillManager per RenderView. | |
23 class PasswordAutofillManager { | |
24 public: | |
25 explicit PasswordAutofillManager(TabContentsWrapper* tab_contents_wrapper); | |
26 virtual ~PasswordAutofillManager(); | |
27 | |
28 // If they return true, it indicates the event was consumed and should not | |
29 // be used for any other autofill activity. | |
30 bool TextFieldHandlingKeyDown(const webkit::forms::FormField& field, | |
31 int key_code); | |
32 | |
33 // Fills the password associated with user name |value|. Returns true if the | |
34 // username and password fields were filled, false otherwise. | |
35 bool DidAcceptAutofillSuggestion(const webkit::forms::FormField& field, | |
36 const string16& value); | |
37 | |
38 // A no-op. No filling happens for selection. But this method returns | |
39 // true when |node| is fillable by password Autofill. | |
40 bool DidSelectAutofillSuggestion(const webkit::forms::FormField& field); | |
41 | |
42 // A no-op. Password forms are not previewed, so they do not need to be | |
43 // cleared when the selection changes. However, this method returns | |
44 // true when |node| is fillable by password Autofill. | |
45 bool DidClearAutofillSelection(const webkit::forms::FormField& field); | |
46 | |
47 // Invoked when a password form is filled. | |
48 void FillPasswordForm(const webkit::forms::FormField& username_element, | |
49 const webkit::forms::PasswordFormFillData& form_data, | |
50 int frame_id); | |
51 | |
52 // Invoked when the passed frame is closing. Gives us a chance to clear any | |
53 // reference we may have to elements in that frame. | |
54 void FrameClosing(long long frame_id); | |
Ilya Sherman
2012/03/06 20:32:44
Why "long long"?
csharp
2012/03/07 15:49:16
WebFrame's unique identifier is a long long.
Ilya Sherman
2012/03/07 22:33:18
In that case, why "int" above?
csharp
2012/03/08 16:48:37
Fixed.
| |
55 | |
56 private: | |
57 struct PasswordInfo { | |
58 long long frame_id; | |
59 webkit::forms::PasswordFormFillData fill_data; | |
60 bool backspace_pressed_last; | |
61 PasswordInfo() : backspace_pressed_last(false) {} | |
62 }; | |
63 typedef std::map<webkit::forms::FormField, PasswordInfo> | |
64 LoginToPasswordInfoMap; | |
65 | |
66 bool WillFillUserNameAndPassword( | |
67 const webkit::forms::FormField& username_element, | |
68 const webkit::forms::PasswordFormFillData& fill_data); | |
69 | |
70 // Finds login information for a |node| that was previously filled. | |
71 bool FindLoginInfo(const webkit::forms::FormField& field, | |
72 webkit::forms::FormField* found_input, | |
73 PasswordInfo* found_password); | |
74 | |
75 // The logins we have filled so far with their associated info. | |
76 LoginToPasswordInfoMap login_to_password_info_; | |
77 | |
78 TabContentsWrapper* tab_contents_wrapper_; // Weak reference. | |
79 | |
80 DISALLOW_COPY_AND_ASSIGN(PasswordAutofillManager); | |
81 }; | |
82 | |
83 #endif // CHROME_BROWSER_AUTOFILL_PASSWORD_AUTOFILL_MANAGER_H_ | |
OLD | NEW |