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

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

Issue 2439953004: Remove invalid "suffix" assumption from CreateSortKey (Closed)
Patch Set: Review comments Created 4 years, 2 months 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
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 1e130bafb591dbf7c402d0d692f08e33d0fcce57..b332f5120d2fd0f5644c1b2b806e7ed451851079 100644
--- a/chrome/browser/ui/passwords/password_manager_presenter.cc
+++ b/chrome/browser/ui/passwords/password_manager_presenter.cc
@@ -63,11 +63,11 @@ std::string GetEntryTypeCode(bool is_android_uri, bool is_clickable) {
return "2";
}
-// Creates key for sorting password or password exception entries.
-// The key is eTLD+1 followed by subdomains
-// (e.g. secure.accounts.example.com => example.com.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
+// 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.
std::string CreateSortKey(const autofill::PasswordForm& form,
PasswordEntryType entry_type) {
@@ -77,18 +77,15 @@ std::string CreateSortKey(const autofill::PasswordForm& form,
std::string origin = password_manager::GetShownOriginAndLinkUrl(
form, &is_android_uri, &link_url, &is_clickable);
- if (!is_clickable) { // e.g. android://com.example.r => r.example.com.
+ if (!is_clickable) // e.g. android://com.example.r => r.example.com.
origin = password_manager::StripAndroidAndReverse(origin);
- }
std::string site_name =
net::registry_controlled_domains::GetDomainAndRegistry(
origin, net::registry_controlled_domains::INCLUDE_PRIVATE_REGISTRIES);
if (site_name.empty()) // e.g. localhost.
site_name = origin;
- std::string key =
- site_name + password_manager::SplitByDotAndReverse(StringPiece(
- &origin[0], origin.length() - site_name.length()));
+ std::string key = site_name + password_manager::SplitByDotAndReverse(origin);
if (entry_type == PasswordEntryType::SAVED) {
key = key + kSortKeyPartsSeparator +

Powered by Google App Engine
This is Rietveld 408576698