Fix build break
[chromium-blink-merge.git] / content / renderer / password_form_conversion_utils.cc
blobd17381594ef6baabecc0e190d08182eb8ae4dda1
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.
5 #include "content/public/renderer/password_form_conversion_utils.h"
7 #include "content/public/common/password_form.h"
8 #include "third_party/WebKit/Source/WebKit/chromium/public/WebPasswordFormData.h"
10 using WebKit::WebFormElement;
11 using WebKit::WebPasswordFormData;
13 namespace content {
14 namespace {
16 scoped_ptr<PasswordForm> InitPasswordFormFromWebPasswordForm(
17 const WebKit::WebPasswordFormData& web_password_form) {
18 PasswordForm* password_form = new PasswordForm();
19 password_form->signon_realm = web_password_form.signonRealm.utf8();
20 password_form->origin = web_password_form.origin;
21 password_form->action = web_password_form.action;
22 password_form->submit_element = web_password_form.submitElement;
23 password_form->username_element = web_password_form.userNameElement;
24 password_form->username_value = web_password_form.userNameValue;
25 password_form->possible_usernames.insert(
26 password_form->possible_usernames.begin(),
27 web_password_form.possibleUserNames.data(),
28 web_password_form.possibleUserNames.data() +
29 web_password_form.possibleUserNames.size());
30 password_form->password_element = web_password_form.passwordElement;
31 password_form->password_value = web_password_form.passwordValue;
32 password_form->password_autocomplete_set =
33 web_password_form.passwordShouldAutocomplete;
34 password_form->old_password_element = web_password_form.oldPasswordElement;
35 password_form->old_password_value = web_password_form.oldPasswordValue;
36 password_form->scheme = PasswordForm::SCHEME_HTML;
37 password_form->ssl_valid = false;
38 password_form->preferred = false;
39 password_form->blacklisted_by_user = false;
40 password_form->type = PasswordForm::TYPE_MANUAL;
41 return scoped_ptr<PasswordForm>(password_form);
44 } // namespace
46 scoped_ptr<PasswordForm> CreatePasswordForm(const WebFormElement& webform) {
47 WebPasswordFormData web_password_form(webform);
48 if (web_password_form.isValid())
49 return InitPasswordFormFromWebPasswordForm(web_password_form);
50 return scoped_ptr<PasswordForm>();
53 } // namespace content