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

Side by Side Diff: webkit/glue/password_form_dom_manager.cc

Issue 8680040: Group forms-related files in webkit/glue in a forms/ subdirectory. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase + another build fix Created 9 years 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 | Annotate | Revision Log
« no previous file with comments | « webkit/glue/password_form_dom_manager.h ('k') | webkit/glue/webkit_glue.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright (c) 2011 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 #include "webkit/glue/password_form_dom_manager.h"
6
7 #include "base/logging.h"
8 #include "third_party/WebKit/Source/WebKit/chromium/public/WebInputElement.h"
9 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPasswordFormData.h "
10 #include "webkit/glue/form_field.h"
11
12 using WebKit::WebFormElement;
13 using WebKit::WebInputElement;
14 using WebKit::WebPasswordFormData;
15
16 namespace webkit_glue {
17
18 PasswordFormFillData::PasswordFormFillData() : wait_for_username(false) {
19 }
20
21 PasswordFormFillData::~PasswordFormFillData() {
22 }
23
24 PasswordForm* PasswordFormDomManager::CreatePasswordForm(
25 const WebFormElement& webform) {
26 WebPasswordFormData web_password_form(webform);
27 if (web_password_form.isValid())
28 return new PasswordForm(web_password_form);
29 return NULL;
30 }
31
32 // static
33 void PasswordFormDomManager::InitFillData(
34 const PasswordForm& form_on_page,
35 const PasswordFormMap& matches,
36 const PasswordForm* const preferred_match,
37 bool wait_for_username_before_autofill,
38 PasswordFormFillData* result) {
39 // Note that many of the |FormField| members are not initialized for
40 // |username_field| and |password_field| because they are currently not used
41 // by the password autocomplete code.
42 FormField username_field;
43 username_field.name = form_on_page.username_element;
44 username_field.value = preferred_match->username_value;
45 FormField password_field;
46 password_field.name = form_on_page.password_element;
47 password_field.value = preferred_match->password_value;
48
49 // Fill basic form data.
50 result->basic_data.origin = form_on_page.origin;
51 result->basic_data.action = form_on_page.action;
52 result->basic_data.fields.push_back(username_field);
53 result->basic_data.fields.push_back(password_field);
54 result->wait_for_username = wait_for_username_before_autofill;
55
56 // Copy additional username/value pairs.
57 PasswordFormMap::const_iterator iter;
58 for (iter = matches.begin(); iter != matches.end(); iter++) {
59 if (iter->second != preferred_match)
60 result->additional_logins[iter->first] = iter->second->password_value;
61 }
62 }
63
64 } // namespace webkit_glue
OLDNEW
« no previous file with comments | « webkit/glue/password_form_dom_manager.h ('k') | webkit/glue/webkit_glue.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698