OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 #include "components/password_manager/core/common/credential_manager_types.h" | 5 #include "components/password_manager/core/common/credential_manager_types.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "components/autofill/core/common/password_form.h" | 8 #include "components/autofill/core/common/password_form.h" |
9 | 9 |
10 namespace password_manager { | 10 namespace password_manager { |
(...skipping 24 matching lines...) Expand all Loading... |
35 } | 35 } |
36 | 36 |
37 CredentialInfo::~CredentialInfo() { | 37 CredentialInfo::~CredentialInfo() { |
38 } | 38 } |
39 | 39 |
40 scoped_ptr<autofill::PasswordForm> CreatePasswordFormFromCredentialInfo( | 40 scoped_ptr<autofill::PasswordForm> CreatePasswordFormFromCredentialInfo( |
41 const CredentialInfo& info, | 41 const CredentialInfo& info, |
42 const GURL& origin) { | 42 const GURL& origin) { |
43 scoped_ptr<autofill::PasswordForm> form; | 43 scoped_ptr<autofill::PasswordForm> form; |
44 if (info.type == CredentialType::CREDENTIAL_TYPE_EMPTY) | 44 if (info.type == CredentialType::CREDENTIAL_TYPE_EMPTY) |
45 return form.Pass(); | 45 return form; |
46 | 46 |
47 form.reset(new autofill::PasswordForm); | 47 form.reset(new autofill::PasswordForm); |
48 form->icon_url = info.icon; | 48 form->icon_url = info.icon; |
49 form->display_name = info.name; | 49 form->display_name = info.name; |
50 form->federation_url = info.federation; | 50 form->federation_url = info.federation; |
51 form->origin = origin; | 51 form->origin = origin; |
52 form->password_value = info.password; | 52 form->password_value = info.password; |
53 form->username_value = info.id; | 53 form->username_value = info.id; |
54 form->scheme = autofill::PasswordForm::SCHEME_HTML; | 54 form->scheme = autofill::PasswordForm::SCHEME_HTML; |
55 | 55 |
56 form->signon_realm = | 56 form->signon_realm = |
57 info.type == CredentialType::CREDENTIAL_TYPE_PASSWORD | 57 info.type == CredentialType::CREDENTIAL_TYPE_PASSWORD |
58 ? origin.spec() | 58 ? origin.spec() |
59 : "federation://" + origin.host() + "/" + info.federation.host(); | 59 : "federation://" + origin.host() + "/" + info.federation.host(); |
60 form->username_value = info.id; | 60 form->username_value = info.id; |
61 return form.Pass(); | 61 return form; |
62 } | 62 } |
63 bool CredentialInfo::operator==(const CredentialInfo& rhs) const { | 63 bool CredentialInfo::operator==(const CredentialInfo& rhs) const { |
64 return (type == rhs.type && id == rhs.id && name == rhs.name && | 64 return (type == rhs.type && id == rhs.id && name == rhs.name && |
65 icon == rhs.icon && password == rhs.password && | 65 icon == rhs.icon && password == rhs.password && |
66 federation == rhs.federation); | 66 federation == rhs.federation); |
67 } | 67 } |
68 | 68 |
69 } // namespace password_manager | 69 } // namespace password_manager |
OLD | NEW |