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

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: 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..e28f38ef6a837329d1f6e4e650488cb40310597d 100644
--- a/chrome/browser/ui/passwords/password_manager_presenter.cc
+++ b/chrome/browser/ui/passwords/password_manager_presenter.cc
@@ -53,6 +53,9 @@ namespace {
const char kSortKeyPartsSeparator = ' ';
+// The character that is added to a sort key if there is no federation.
+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) {
@@ -93,8 +96,13 @@ std::string CreateSortKey(const autofill::PasswordForm& form,
base::UTF16ToUTF8(form.password_value);
if (!form.federation_origin.unique())
vasilii 2016/11/15 13:18:11 Why don't you just use Origin::Serialize()?
kolos1 2016/11/15 13:57:38 Serialize() returns "null" if there is no federati
vasilii 2016/11/15 14:14:54 If it's important then it should go to a comment o
kolos1 2016/11/15 14:42:51 Done.
key = key + kSortKeyPartsSeparator + form.federation_origin.host();
+ else
+ key = key + kSortKeyPartsSeparator + kSortKeyNoFederationSymbol;
vasilii 2016/11/15 13:18:10 key+= is faster and easier to read.
kolos1 2016/11/15 13:57:38 In this particular case, we cannot use +=, because
vasilii 2016/11/15 14:14:55 key += kSortKeyPartsSeparator; if () key += form
kolos1 2016/11/15 14:42:51 Done.
}
+ // 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