Chromium Code Reviews| 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..034da780cac7b91a5baa120ce7dd7c48324e334f 100644 |
| --- a/components/password_manager/core/browser/password_ui_utils.cc |
| +++ b/components/password_manager/core/browser/password_ui_utils.cc |
| @@ -6,12 +6,16 @@ |
| #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" |
| #include "components/password_manager/core/browser/affiliation_utils.h" |
| #include "components/url_formatter/elide_url.h" |
| +using base::StringPiece; |
|
vabr (Chromium)
2016/06/08 09:04:05
optional: My suggestion would be to drop the "usin
dozsa
2016/06/08 11:22:30
Done.
|
| + |
| namespace password_manager { |
| namespace { |
| @@ -21,6 +25,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(StringPiece host) { |
|
vabr (Chromium)
2016/06/08 09:04:05
This function also needs tests. Please have a look
vabr (Chromium)
2016/06/08 09:04:05
Please make sure to also use this function in chro
dozsa
2016/06/08 11:22:30
Done.
dozsa
2016/06/08 11:22:30
Done.
|
| + 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, |