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

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

Issue 1765993002: Remove UnescapeRule::URL_SPECIAL_CHARS from components/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Response to comments Created 4 years, 9 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"
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 93
94 // Canonicalizes the username component in an Android facet URI (containing the 94 // Canonicalizes the username component in an Android facet URI (containing the
95 // certificate hash), and returns true if canonicalization was successful and 95 // certificate hash), and returns true if canonicalization was successful and
96 // produced a valid non-empty component. 96 // produced a valid non-empty component.
97 bool CanonicalizeHashComponent(const base::StringPiece& input_hash, 97 bool CanonicalizeHashComponent(const base::StringPiece& input_hash,
98 url::CanonOutput* canonical_output) { 98 url::CanonOutput* canonical_output) {
99 // Characters other than alphanumeric that are used in the "URL and filename 99 // Characters other than alphanumeric that are used in the "URL and filename
100 // safe" base64 alphabet; plus the padding ('='). 100 // safe" base64 alphabet; plus the padding ('=').
101 const char kBase64NonAlphanumericChars[] = "-_="; 101 const char kBase64NonAlphanumericChars[] = "-_=";
102 102
103 // We need net::UnescapeRule::URL_SPECIAL_CHARS to unescape the padding ('='). 103 // We need net::UnescapeRule::URL_SPECIAL_CHARS_EXCEPT_PATH_SEPARATORS to
104 // unescape the padding ('=').
104 std::string base64_encoded_hash = net::UnescapeURLComponent( 105 std::string base64_encoded_hash = net::UnescapeURLComponent(
105 input_hash.as_string(), net::UnescapeRule::URL_SPECIAL_CHARS); 106 input_hash.as_string(),
107 net::UnescapeRule::URL_SPECIAL_CHARS_EXCEPT_PATH_SEPARATORS);
106 108
107 if (!base64_encoded_hash.empty() && 109 if (!base64_encoded_hash.empty() &&
108 CanonicalizeBase64Padding(&base64_encoded_hash) && 110 CanonicalizeBase64Padding(&base64_encoded_hash) &&
109 ContainsOnlyAlphanumericAnd(base64_encoded_hash, 111 ContainsOnlyAlphanumericAnd(base64_encoded_hash,
110 kBase64NonAlphanumericChars)) { 112 kBase64NonAlphanumericChars)) {
111 canonical_output->Append(base64_encoded_hash.data(), 113 canonical_output->Append(base64_encoded_hash.data(),
112 base64_encoded_hash.size()); 114 base64_encoded_hash.size());
113 canonical_output->push_back('@'); 115 canonical_output->push_back('@');
114 return true; 116 return true;
115 } 117 }
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
338 return base::UTF16ToUTF8(url_formatter::FormatUrlForSecurityDisplay( 340 return base::UTF16ToUTF8(url_formatter::FormatUrlForSecurityDisplay(
339 password_form.origin, languages)); 341 password_form.origin, languages));
340 } 342 }
341 343
342 std::string GetHumanReadableOriginForAndroidUri(const FacetURI facet_uri) { 344 std::string GetHumanReadableOriginForAndroidUri(const FacetURI facet_uri) {
343 DCHECK(facet_uri.IsValidAndroidFacetURI()); 345 DCHECK(facet_uri.IsValidAndroidFacetURI());
344 return facet_uri.scheme() + "://" + facet_uri.android_package_name(); 346 return facet_uri.scheme() + "://" + facet_uri.android_package_name();
345 } 347 }
346 348
347 } // namespace password_manager 349 } // namespace password_manager
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698