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

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

Issue 597983003: Refactor PasswordAutofillAgent: methods to functions. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 2 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 <vector> 9 #include <vector>
10 10
11 #include "base/memory/linked_ptr.h" 11 #include "base/memory/linked_ptr.h"
12 #include "base/memory/weak_ptr.h" 12 #include "base/memory/weak_ptr.h"
13 #include "components/autofill/core/common/password_form_fill_data.h" 13 #include "components/autofill/core/common/password_form_fill_data.h"
14 #include "content/public/renderer/render_view_observer.h" 14 #include "content/public/renderer/render_view_observer.h"
15 #include "third_party/WebKit/public/web/WebInputElement.h" 15 #include "third_party/WebKit/public/web/WebInputElement.h"
16 16
17 namespace blink { 17 namespace blink {
18 class WebInputElement; 18 class WebInputElement;
19 class WebKeyboardEvent; 19 class WebKeyboardEvent;
20 class WebSecurityOrigin; 20 class WebSecurityOrigin;
21 class WebView; 21 class WebView;
22 } 22 }
23 23
24 namespace autofill { 24 namespace autofill {
25 25
26 // This struct is used in helper function to indicate parameter modification.
vabr (Chromium) 2014/09/25 10:25:49 Please don't introduce this struct. I indicated be
Deepak 2014/09/25 12:02:26 Thanks,I will take care in future.
27 struct ParametersNeedUpdate {
28 bool usernames_usage;
29 bool gate_keeper;
30 ParametersNeedUpdate() {
vabr (Chromium) 2014/09/25 10:25:49 (Just for future: it is considered better practice
Deepak 2014/09/25 12:02:26 Thanks,I will take care in future.
31 usernames_usage = false;
32 gate_keeper = false;
33 };
34 };
35
26 // This class is responsible for filling password forms. 36 // This class is responsible for filling password forms.
27 // There is one PasswordAutofillAgent per RenderView. 37 // There is one PasswordAutofillAgent per RenderView.
28 class PasswordAutofillAgent : public content::RenderViewObserver { 38 class PasswordAutofillAgent : public content::RenderViewObserver {
29 public: 39 public:
30 explicit PasswordAutofillAgent(content::RenderView* render_view); 40 explicit PasswordAutofillAgent(content::RenderView* render_view);
31 virtual ~PasswordAutofillAgent(); 41 virtual ~PasswordAutofillAgent();
32 42
33 // WebViewClient editor related calls forwarded by the RenderView. 43 // WebViewClient editor related calls forwarded by the RenderView.
34 // If they return true, it indicates the event was consumed and should not 44 // If they return true, it indicates the event was consumed and should not
35 // be used for any other autofill activity. 45 // be used for any other autofill activity.
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 const blink::WebFormElement& form) OVERRIDE; 156 const blink::WebFormElement& form) OVERRIDE;
147 157
148 // RenderView IPC handlers: 158 // RenderView IPC handlers:
149 void OnFillPasswordForm(const PasswordFormFillData& form_data); 159 void OnFillPasswordForm(const PasswordFormFillData& form_data);
150 void OnSetLoggingState(bool active); 160 void OnSetLoggingState(bool active);
151 161
152 // Scans the given frame for password forms and sends them up to the browser. 162 // Scans the given frame for password forms and sends them up to the browser.
153 // If |only_visible| is true, only forms visible in the layout are sent. 163 // If |only_visible| is true, only forms visible in the layout are sent.
154 void SendPasswordForms(blink::WebFrame* frame, bool only_visible); 164 void SendPasswordForms(blink::WebFrame* frame, bool only_visible);
155 165
156 void GetSuggestions(const PasswordFormFillData& fill_data,
157 const base::string16& input,
158 std::vector<base::string16>* suggestions,
159 std::vector<base::string16>* realms,
160 bool show_all);
161
162 bool ShowSuggestionPopup(const PasswordFormFillData& fill_data, 166 bool ShowSuggestionPopup(const PasswordFormFillData& fill_data,
163 const blink::WebInputElement& user_input, 167 const blink::WebInputElement& user_input,
164 bool show_all); 168 bool show_all);
165 169
166 // Attempts to fill |username_element| and |password_element| with the
167 // |fill_data|. Will use the data corresponding to the preferred username,
168 // unless the |username_element| already has a value set. In that case,
169 // attempts to fill the password matching the already filled username, if
170 // such a password exists.
171 void FillFormOnPasswordRecieved(const PasswordFormFillData& fill_data,
172 blink::WebInputElement username_element,
173 blink::WebInputElement password_element);
174
175 bool FillUserNameAndPassword(blink::WebInputElement* username_element,
176 blink::WebInputElement* password_element,
177 const PasswordFormFillData& fill_data,
178 bool exact_username_match,
179 bool set_selection);
180 170
181 // Fills |login_input| and |password| with the most relevant suggestion from 171 // Fills |login_input| and |password| with the most relevant suggestion from
182 // |fill_data| and shows a popup with other suggestions. 172 // |fill_data| and shows a popup with other suggestions.
183 void PerformInlineAutocomplete( 173 void PerformInlineAutocomplete(
184 const blink::WebInputElement& username, 174 const blink::WebInputElement& username,
185 const blink::WebInputElement& password, 175 const blink::WebInputElement& password,
186 const PasswordFormFillData& fill_data); 176 const PasswordFormFillData& fill_data);
187 177
188 // Invoked when the passed frame is closing. Gives us a chance to clear any 178 // Invoked when the passed frame is closing. Gives us a chance to clear any
189 // reference we may have to elements in that frame. 179 // reference we may have to elements in that frame.
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
243 bool did_stop_loading_; 233 bool did_stop_loading_;
244 234
245 base::WeakPtrFactory<PasswordAutofillAgent> weak_ptr_factory_; 235 base::WeakPtrFactory<PasswordAutofillAgent> weak_ptr_factory_;
246 236
247 DISALLOW_COPY_AND_ASSIGN(PasswordAutofillAgent); 237 DISALLOW_COPY_AND_ASSIGN(PasswordAutofillAgent);
248 }; 238 };
249 239
250 } // namespace autofill 240 } // namespace autofill
251 241
252 #endif // COMPONENTS_AUTOFILL_CONTENT_RENDERER_PASSWORD_AUTOFILL_AGENT_H_ 242 #endif // COMPONENTS_AUTOFILL_CONTENT_RENDERER_PASSWORD_AUTOFILL_AGENT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698