OLD | NEW |
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 |
(...skipping 28 matching lines...) Expand all Loading... |
39 const blink::WebKeyboardEvent& event); | 39 const blink::WebKeyboardEvent& event); |
40 | 40 |
41 // Fills the password associated with user name |username|. Returns true if | 41 // Fills the password associated with user name |username|. Returns true if |
42 // the username and password fields were filled, false otherwise. | 42 // the username and password fields were filled, false otherwise. |
43 bool DidAcceptAutofillSuggestion(const blink::WebNode& node, | 43 bool DidAcceptAutofillSuggestion(const blink::WebNode& node, |
44 const blink::WebString& username); | 44 const blink::WebString& username); |
45 // A no-op. Password forms are not previewed, so they do not need to be | 45 // A no-op. Password forms are not previewed, so they do not need to be |
46 // cleared when the selection changes. However, this method returns | 46 // cleared when the selection changes. However, this method returns |
47 // true when |node| is fillable by password Autofill. | 47 // true when |node| is fillable by password Autofill. |
48 bool DidClearAutofillSelection(const blink::WebNode& node); | 48 bool DidClearAutofillSelection(const blink::WebNode& node); |
49 // Shows an Autofill popup with username suggestions for |element|. | 49 // Shows an Autofill popup with username suggestions for |element|. If |
| 50 // |show_all| is |true|, will show all possible suggestions for that element, |
| 51 // otherwise shows suggestions based on current value of |element|. |
50 // Returns true if any suggestions were shown, false otherwise. | 52 // Returns true if any suggestions were shown, false otherwise. |
51 bool ShowSuggestions(const blink::WebInputElement& element); | 53 bool ShowSuggestions(const blink::WebInputElement& element, bool show_all); |
52 | 54 |
53 // Called when new form controls are inserted. | 55 // Called when new form controls are inserted. |
54 void OnDynamicFormsSeen(blink::WebFrame* frame); | 56 void OnDynamicFormsSeen(blink::WebFrame* frame); |
55 | 57 |
56 protected: | 58 protected: |
57 virtual bool OriginCanAccessPasswordManager( | 59 virtual bool OriginCanAccessPasswordManager( |
58 const blink::WebSecurityOrigin& origin); | 60 const blink::WebSecurityOrigin& origin); |
59 | 61 |
| 62 // RenderViewObserver: |
| 63 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
| 64 |
60 private: | 65 private: |
61 friend class PasswordAutofillAgentTest; | 66 friend class PasswordAutofillAgentTest; |
62 | 67 |
63 enum OtherPossibleUsernamesUsage { | 68 enum OtherPossibleUsernamesUsage { |
64 NOTHING_TO_AUTOFILL, | 69 NOTHING_TO_AUTOFILL, |
65 OTHER_POSSIBLE_USERNAMES_ABSENT, | 70 OTHER_POSSIBLE_USERNAMES_ABSENT, |
66 OTHER_POSSIBLE_USERNAMES_PRESENT, | 71 OTHER_POSSIBLE_USERNAMES_PRESENT, |
67 OTHER_POSSIBLE_USERNAME_SHOWN, | 72 OTHER_POSSIBLE_USERNAME_SHOWN, |
68 OTHER_POSSIBLE_USERNAME_SELECTED, | 73 OTHER_POSSIBLE_USERNAME_SELECTED, |
69 OTHER_POSSIBLE_USERNAMES_MAX | 74 OTHER_POSSIBLE_USERNAMES_MAX |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 // Make the value of |element| accessible to JavaScript code. | 107 // Make the value of |element| accessible to JavaScript code. |
103 void ShowValue(blink::WebInputElement* element); | 108 void ShowValue(blink::WebInputElement* element); |
104 | 109 |
105 bool was_user_gesture_seen_; | 110 bool was_user_gesture_seen_; |
106 std::vector<blink::WebInputElement> elements_; | 111 std::vector<blink::WebInputElement> elements_; |
107 | 112 |
108 DISALLOW_COPY_AND_ASSIGN(PasswordValueGatekeeper); | 113 DISALLOW_COPY_AND_ASSIGN(PasswordValueGatekeeper); |
109 }; | 114 }; |
110 | 115 |
111 // RenderViewObserver: | 116 // RenderViewObserver: |
112 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | |
113 virtual void DidStartProvisionalLoad(blink::WebFrame* frame) OVERRIDE; | 117 virtual void DidStartProvisionalLoad(blink::WebFrame* frame) OVERRIDE; |
114 virtual void DidStartLoading() OVERRIDE; | 118 virtual void DidStartLoading() OVERRIDE; |
115 virtual void DidFinishDocumentLoad(blink::WebFrame* frame) OVERRIDE; | 119 virtual void DidFinishDocumentLoad(blink::WebFrame* frame) OVERRIDE; |
116 virtual void DidFinishLoad(blink::WebFrame* frame) OVERRIDE; | 120 virtual void DidFinishLoad(blink::WebFrame* frame) OVERRIDE; |
117 virtual void FrameDetached(blink::WebFrame* frame) OVERRIDE; | 121 virtual void FrameDetached(blink::WebFrame* frame) OVERRIDE; |
118 virtual void FrameWillClose(blink::WebFrame* frame) OVERRIDE; | 122 virtual void FrameWillClose(blink::WebFrame* frame) OVERRIDE; |
119 virtual void WillSendSubmitEvent(blink::WebFrame* frame, | 123 virtual void WillSendSubmitEvent(blink::WebFrame* frame, |
120 const blink::WebFormElement& form) OVERRIDE; | 124 const blink::WebFormElement& form) OVERRIDE; |
121 virtual void WillSubmitForm(blink::WebFrame* frame, | 125 virtual void WillSubmitForm(blink::WebFrame* frame, |
122 const blink::WebFormElement& form) OVERRIDE; | 126 const blink::WebFormElement& form) OVERRIDE; |
123 virtual void WillProcessUserGesture() OVERRIDE; | 127 virtual void WillProcessUserGesture() OVERRIDE; |
124 | 128 |
125 // RenderView IPC handlers: | 129 // RenderView IPC handlers: |
126 void OnFillPasswordForm(const PasswordFormFillData& form_data); | 130 void OnFillPasswordForm(const PasswordFormFillData& form_data); |
127 | 131 |
128 // Scans the given frame for password forms and sends them up to the browser. | 132 // Scans the given frame for password forms and sends them up to the browser. |
129 // If |only_visible| is true, only forms visible in the layout are sent. | 133 // If |only_visible| is true, only forms visible in the layout are sent. |
130 void SendPasswordForms(blink::WebFrame* frame, bool only_visible); | 134 void SendPasswordForms(blink::WebFrame* frame, bool only_visible); |
131 | 135 |
132 void GetSuggestions(const PasswordFormFillData& fill_data, | 136 void GetSuggestions(const PasswordFormFillData& fill_data, |
133 const base::string16& input, | 137 const base::string16& input, |
134 std::vector<base::string16>* suggestions, | 138 std::vector<base::string16>* suggestions, |
135 std::vector<base::string16>* realms); | 139 std::vector<base::string16>* realms, |
| 140 bool show_all); |
136 | 141 |
137 bool ShowSuggestionPopup(const PasswordFormFillData& fill_data, | 142 bool ShowSuggestionPopup(const PasswordFormFillData& fill_data, |
138 const blink::WebInputElement& user_input); | 143 const blink::WebInputElement& user_input, |
| 144 bool show_all); |
139 | 145 |
140 // Attempts to fill |username_element| and |password_element| with the | 146 // Attempts to fill |username_element| and |password_element| with the |
141 // |fill_data|. Will use the data corresponding to the preferred username, | 147 // |fill_data|. Will use the data corresponding to the preferred username, |
142 // unless the |username_element| already has a value set. In that case, | 148 // unless the |username_element| already has a value set. In that case, |
143 // attempts to fill the password matching the already filled username, if | 149 // attempts to fill the password matching the already filled username, if |
144 // such a password exists. | 150 // such a password exists. |
145 void FillFormOnPasswordRecieved(const PasswordFormFillData& fill_data, | 151 void FillFormOnPasswordRecieved(const PasswordFormFillData& fill_data, |
146 blink::WebInputElement username_element, | 152 blink::WebInputElement username_element, |
147 blink::WebInputElement password_element); | 153 blink::WebInputElement password_element); |
148 | 154 |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
190 PasswordValueGatekeeper gatekeeper_; | 196 PasswordValueGatekeeper gatekeeper_; |
191 | 197 |
192 base::WeakPtrFactory<PasswordAutofillAgent> weak_ptr_factory_; | 198 base::WeakPtrFactory<PasswordAutofillAgent> weak_ptr_factory_; |
193 | 199 |
194 DISALLOW_COPY_AND_ASSIGN(PasswordAutofillAgent); | 200 DISALLOW_COPY_AND_ASSIGN(PasswordAutofillAgent); |
195 }; | 201 }; |
196 | 202 |
197 } // namespace autofill | 203 } // namespace autofill |
198 | 204 |
199 #endif // COMPONENTS_AUTOFILL_CONTENT_RENDERER_PASSWORD_AUTOFILL_AGENT_H_ | 205 #endif // COMPONENTS_AUTOFILL_CONTENT_RENDERER_PASSWORD_AUTOFILL_AGENT_H_ |
OLD | NEW |