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

Unified Diff: components/password_manager/core/browser/password_ui_utils.cc

Issue 2042033003: Displaying human-readable Android credentials on Android OS. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added unit test for SplitByDotAndReverse, addressed style issues. 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: components/password_manager/core/browser/password_ui_utils.cc
diff --git a/components/password_manager/core/browser/password_ui_utils.cc b/components/password_manager/core/browser/password_ui_utils.cc
index 239213192858277e3234f5713582700c7099205d..e2567805c8f7bfed2cbe342d8ddee8391d7d9fee 100644
--- a/components/password_manager/core/browser/password_ui_utils.cc
+++ b/components/password_manager/core/browser/password_ui_utils.cc
@@ -6,6 +6,8 @@
#include <string>
+#include "base/strings/string_piece.h"
+#include "base/strings/string_split.h"
#include "base/strings/string_util.h"
#include "base/strings/utf_string_conversions.h"
#include "components/autofill/core/common/password_form.h"
@@ -21,6 +23,16 @@ const char* const kRemovedPrefixes[] = {"m.", "mobile.", "www."};
} // namespace
+const int kAndroidAppSchemeAndDelimiterLength = 10; // Length of 'android://'.
+
+// Reverse order of subdomains in hostname.
+std::string SplitByDotAndReverse(base::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, ".");
+}
+
std::string GetShownOriginAndLinkUrl(
const autofill::PasswordForm& password_form,
bool* is_android_uri,

Powered by Google App Engine
This is Rietveld 408576698