OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/browser/password_manager/native_backend_gnome_x.h" | 5 #include "chrome/browser/password_manager/native_backend_gnome_x.h" |
6 | 6 |
7 #include <dlfcn.h> | 7 #include <dlfcn.h> |
8 #include <gnome-keyring.h> | 8 #include <gnome-keyring.h> |
9 | 9 |
10 #include <map> | 10 #include <map> |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
158 for (GList* element = g_list_first(found); element != NULL; | 158 for (GList* element = g_list_first(found); element != NULL; |
159 element = g_list_next(element)) { | 159 element = g_list_next(element)) { |
160 GnomeKeyringFound* data = static_cast<GnomeKeyringFound*>(element->data); | 160 GnomeKeyringFound* data = static_cast<GnomeKeyringFound*>(element->data); |
161 GnomeKeyringAttributeList* attrs = data->attributes; | 161 GnomeKeyringAttributeList* attrs = data->attributes; |
162 | 162 |
163 scoped_ptr<PasswordForm> form(FormFromAttributes(attrs)); | 163 scoped_ptr<PasswordForm> form(FormFromAttributes(attrs)); |
164 if (form) { | 164 if (form) { |
165 if (lookup_form && form->signon_realm != lookup_form->signon_realm) { | 165 if (lookup_form && form->signon_realm != lookup_form->signon_realm) { |
166 // This is not an exact match, we try PSL matching. | 166 // This is not an exact match, we try PSL matching. |
167 if (!(PSLMatchingHelper::IsPublicSuffixDomainMatch( | 167 if (!(PSLMatchingHelper::IsPublicSuffixDomainMatch( |
168 lookup_form->signon_realm, form->signon_realm))) { | 168 lookup_form->signon_realm, form->signon_realm)) || |
169 lookup_form->scheme != PasswordForm::SCHEME_HTML || | |
vabr (Chromium)
2014/05/07 07:57:38
optional nit: the added tests are cheaper than the
Garrett Casto
2014/05/08 20:01:20
Done.
| |
170 form->scheme != PasswordForm::SCHEME_HTML) { | |
169 continue; | 171 continue; |
170 } | 172 } |
171 psl_domain_match_metric = PSLMatchingHelper::PSL_DOMAIN_MATCH_FOUND; | 173 psl_domain_match_metric = PSLMatchingHelper::PSL_DOMAIN_MATCH_FOUND; |
172 form->original_signon_realm = form->signon_realm; | 174 form->original_signon_realm = form->signon_realm; |
173 form->signon_realm = lookup_form->signon_realm; | 175 form->signon_realm = lookup_form->signon_realm; |
174 form->origin = lookup_form->origin; | 176 form->origin = lookup_form->origin; |
175 form->action = lookup_form->action; | 177 form->action = lookup_form->action; |
176 } | 178 } |
177 if (data->secret) { | 179 if (data->secret) { |
178 form->password_value = UTF8ToUTF16(data->secret); | 180 form->password_value = UTF8ToUTF16(data->secret); |
(...skipping 557 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
736 } | 738 } |
737 return true; | 739 return true; |
738 } | 740 } |
739 | 741 |
740 std::string NativeBackendGnome::GetProfileSpecificAppString() const { | 742 std::string NativeBackendGnome::GetProfileSpecificAppString() const { |
741 // Originally, the application string was always just "chrome" and used only | 743 // Originally, the application string was always just "chrome" and used only |
742 // so that we had *something* to search for since GNOME Keyring won't search | 744 // so that we had *something* to search for since GNOME Keyring won't search |
743 // for nothing. Now we use it to distinguish passwords for different profiles. | 745 // for nothing. Now we use it to distinguish passwords for different profiles. |
744 return base::StringPrintf("%s-%d", kGnomeKeyringAppString, profile_id_); | 746 return base::StringPrintf("%s-%d", kGnomeKeyringAppString, profile_id_); |
745 } | 747 } |
OLD | NEW |