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

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

Issue 2042033003: Displaying human-readable Android credentials on Android OS. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address minor comments Created 4 years, 6 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 aa723080fb0d7b93c4ab4fc4f97752d9a1b66329..a049f670f7a0daf33bf224cc64361ae5c5110d6c 100644
--- a/chrome/browser/ui/passwords/password_manager_presenter.cc
+++ b/chrome/browser/ui/passwords/password_manager_presenter.cc
@@ -4,6 +4,7 @@
#include "chrome/browser/ui/passwords/password_manager_presenter.h"
+#include <algorithm>
#include <utility>
#include "base/bind.h"
@@ -51,18 +52,8 @@ using password_manager::PasswordStore;
namespace {
-const int kAndroidAppSchemeAndDelimiterLength = 10; // Length of 'android://'.
-
const char kSortKeyPartsSeparator = ' ';
-// Reverse order of subdomains in hostname.
-std::string SplitByDotAndReverse(StringPiece host) {
- std::vector<std::string> parts =
- base::SplitString(host, ".", base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL);
- std::reverse(parts.begin(), parts.end());
- return base::JoinString(parts, ".");
-}
-
// 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) {
@@ -88,9 +79,7 @@ std::string CreateSortKey(const autofill::PasswordForm& form,
form, &is_android_uri, &link_url, &is_clickable);
if (!is_clickable) { // e.g. android://com.example.r => r.example.com.
- origin = SplitByDotAndReverse(
- StringPiece(&origin[kAndroidAppSchemeAndDelimiterLength],
- origin.length() - kAndroidAppSchemeAndDelimiterLength));
+ origin = password_manager::StripAndroidAndReverse(origin);
}
std::string site_name =
@@ -99,7 +88,7 @@ std::string CreateSortKey(const autofill::PasswordForm& form,
if (site_name.empty()) // e.g. localhost.
site_name = origin;
std::string key =
- site_name + SplitByDotAndReverse(StringPiece(
+ site_name + password_manager::SplitByDotAndReverse(StringPiece(
&origin[0], origin.length() - site_name.length()));
if (entry_type == PasswordEntryType::SAVED) {
« no previous file with comments | « chrome/browser/android/password_ui_view_android.cc ('k') | components/password_manager/core/browser/password_ui_utils.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698