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

Side by Side Diff: components/password_manager/core/browser/affiliation_utils.cc

Issue 1130213004: [Smart Lock] Make android URL prettifying util available on ios. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased on top of master Created 5 years, 7 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 unified diff | Download patch
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "components/password_manager/core/browser/affiliation_utils.h" 5 #include "components/password_manager/core/browser/affiliation_utils.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <ostream> 8 #include <ostream>
9 9
10 #include "base/base64.h" 10 #include "base/base64.h"
11 #include "base/command_line.h" 11 #include "base/command_line.h"
12 #include "base/metrics/field_trial.h" 12 #include "base/metrics/field_trial.h"
13 #include "base/strings/string_piece.h" 13 #include "base/strings/string_piece.h"
14 #include "base/strings/string_util.h" 14 #include "base/strings/string_util.h"
15 #include "components/autofill/core/common/password_form.h"
15 #include "components/password_manager/core/common/password_manager_switches.h" 16 #include "components/password_manager/core/common/password_manager_switches.h"
16 #include "components/variations/variations_associated_data.h" 17 #include "components/variations/variations_associated_data.h"
17 #include "net/base/escape.h" 18 #include "net/base/escape.h"
18 #include "url/third_party/mozilla/url_parse.h" 19 #include "url/third_party/mozilla/url_parse.h"
19 #include "url/url_canon_stdstring.h" 20 #include "url/url_canon_stdstring.h"
20 #include "url/url_util.h" 21 #include "url/url_util.h"
21 22
22 namespace password_manager { 23 namespace password_manager {
23 24
24 namespace { 25 namespace {
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after
329 if (command_line.HasSwitch(switches::kEnableAffiliationBasedMatching)) 330 if (command_line.HasSwitch(switches::kEnableAffiliationBasedMatching))
330 return true; 331 return true;
331 return LowerCaseEqualsASCII(synthesizing_enabled, "enabled"); 332 return LowerCaseEqualsASCII(synthesizing_enabled, "enabled");
332 } 333 }
333 334
334 bool IsValidAndroidFacetURI(const std::string& url) { 335 bool IsValidAndroidFacetURI(const std::string& url) {
335 FacetURI facet = FacetURI::FromPotentiallyInvalidSpec(url); 336 FacetURI facet = FacetURI::FromPotentiallyInvalidSpec(url);
336 return facet.IsValidAndroidFacetURI(); 337 return facet.IsValidAndroidFacetURI();
337 } 338 }
338 339
340 std::string GetHumanReadableOrigin(const autofill::PasswordForm& password_form,
341 const std::string& languages) {
342 password_manager::FacetURI facet_uri =
343 password_manager::FacetURI::FromPotentiallyInvalidSpec(
344 password_form.signon_realm);
345 if (facet_uri.IsValidAndroidFacetURI())
346 return facet_uri.scheme() + "://" + facet_uri.android_package_name();
347 return base::UTF16ToUTF8(net::FormatUrl(password_form.origin, languages));
348 }
339 } // namespace password_manager 349 } // namespace password_manager
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698