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

Unified Diff: chrome/browser/ui/passwords/password_manager_presenter.cc

Issue 2500393002: [Password Manager] Add the scheme to sort keys for chrome://settings/passwords (Closed)
Patch Set: Changes addressed to reviewer comments Created 4 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/ui/passwords/password_manager_presenter_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/passwords/password_manager_presenter.cc
diff --git a/chrome/browser/ui/passwords/password_manager_presenter.cc b/chrome/browser/ui/passwords/password_manager_presenter.cc
index b332f5120d2fd0f5644c1b2b806e7ed451851079..f2c2893a39e4036b0b46c0d567c9ee073d648b5a 100644
--- a/chrome/browser/ui/passwords/password_manager_presenter.cc
+++ b/chrome/browser/ui/passwords/password_manager_presenter.cc
@@ -53,6 +53,11 @@ namespace {
const char kSortKeyPartsSeparator = ' ';
+// The character that is added to a sort key if there is no federation.
+// Note: to separate the entries w/ federation and the entries w/o federation,
+// this character should be alphabetically smaller than real federations.
+const char kSortKeyNoFederationSymbol = '-';
+
// Helper function that returns the type of the entry (non-Android credentials,
// Android w/ affiliated web realm (i.e. clickable) or w/o web realm).
std::string GetEntryTypeCode(bool is_android_uri, bool is_clickable) {
@@ -65,10 +70,10 @@ std::string GetEntryTypeCode(bool is_android_uri, bool is_clickable) {
// Creates key for sorting password or password exception entries. The key is
// eTLD+1 followed by the reversed list of domains (e.g.
-// secure.accounts.example.com => example.com.com.example.accounts.secure). If
-// |entry_type == SAVED|, username, password and federation are appended to the
-// key. The entry type code (non-Android, Android w/ or w/o affiliated web
-// realm) is also appended to the key.
+// secure.accounts.example.com => example.com.com.example.accounts.secure) and
+// the scheme. If |entry_type == SAVED|, username, password and federation are
+// appended to the key. The entry type code (non-Android, Android w/ or w/o
+// affiliated web realm) is also appended to the key.
std::string CreateSortKey(const autofill::PasswordForm& form,
PasswordEntryType entry_type) {
bool is_android_uri = false;
@@ -88,13 +93,19 @@ std::string CreateSortKey(const autofill::PasswordForm& form,
std::string key = site_name + password_manager::SplitByDotAndReverse(origin);
if (entry_type == PasswordEntryType::SAVED) {
- key = key + kSortKeyPartsSeparator +
- base::UTF16ToUTF8(form.username_value) + kSortKeyPartsSeparator +
- base::UTF16ToUTF8(form.password_value);
+ key += kSortKeyPartsSeparator + base::UTF16ToUTF8(form.username_value) +
+ kSortKeyPartsSeparator + base::UTF16ToUTF8(form.password_value);
+
+ key += kSortKeyPartsSeparator;
if (!form.federation_origin.unique())
- key = key + kSortKeyPartsSeparator + form.federation_origin.host();
+ key += form.federation_origin.host();
+ else
+ key += kSortKeyNoFederationSymbol;
}
+ // To separate HTTP/HTTPS credentials, add the scheme to the key.
+ key += kSortKeyPartsSeparator + link_url.scheme();
+
// Since Android and non-Android entries shouldn't be merged into one entry,
// add the entry type code to the sort key.
key +=
« no previous file with comments | « no previous file | chrome/browser/ui/passwords/password_manager_presenter_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698