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

Side by Side Diff: components/url_formatter/elide_url.cc

Issue 1843063002: Don't show scheme in permission prompts if it is HTTPS (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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
« no previous file with comments | « components/url_formatter/elide_url.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/url_formatter/elide_url.h" 5 #include "components/url_formatter/elide_url.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/strings/string_split.h" 10 #include "base/strings/string_split.h"
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 return base::ASCIIToUTF16(url::kFileSystemScheme) + colon + 133 return base::ASCIIToUTF16(url::kFileSystemScheme) + colon +
134 FormatUrlForSecurityDisplayInternal(*inner_url, languages, 134 FormatUrlForSecurityDisplayInternal(*inner_url, languages,
135 false /*omit_scheme*/); 135 false /*omit_scheme*/);
136 } 136 }
137 137
138 const GURL origin = url.GetOrigin(); 138 const GURL origin = url.GetOrigin();
139 const std::string& scheme = origin.scheme(); 139 const std::string& scheme = origin.scheme();
140 const std::string& host = origin.host(); 140 const std::string& host = origin.host();
141 141
142 base::string16 result; 142 base::string16 result;
143 if (!omit_scheme || !url.SchemeIsHTTPOrHTTPS()) 143 if (!omit_scheme || !url.SchemeIs(url::kHttpsScheme))
palmer 2016/03/30 20:23:34 Maybe url.SchemeIsCryptographic()?
144 result = base::UTF8ToUTF16(scheme) + scheme_separator; 144 result = base::UTF8ToUTF16(scheme) + scheme_separator;
145 result += base::UTF8ToUTF16(host); 145 result += base::UTF8ToUTF16(host);
146 146
147 const int port = origin.IntPort(); 147 const int port = origin.IntPort();
148 const int default_port = url::DefaultPortForScheme( 148 const int default_port = url::DefaultPortForScheme(
149 scheme.c_str(), static_cast<int>(scheme.length())); 149 scheme.c_str(), static_cast<int>(scheme.length()));
150 if (port != url::PORT_UNSPECIFIED && port != default_port) 150 if (port != url::PORT_UNSPECIFIED && port != default_port)
151 result += colon + base::UTF8ToUTF16(origin.port()); 151 result += colon + base::UTF8ToUTF16(origin.port());
152 152
153 return result; 153 return result;
(...skipping 209 matching lines...) Expand 10 before | Expand all | Expand 10 after
363 return FormatUrlForSecurityDisplayInternal(url, languages, false); 363 return FormatUrlForSecurityDisplayInternal(url, languages, false);
364 } 364 }
365 365
366 base::string16 FormatUrlForSecurityDisplayOmitScheme( 366 base::string16 FormatUrlForSecurityDisplayOmitScheme(
367 const GURL& url, 367 const GURL& url,
368 const std::string& languages) { 368 const std::string& languages) {
369 return FormatUrlForSecurityDisplayInternal(url, languages, true); 369 return FormatUrlForSecurityDisplayInternal(url, languages, true);
370 } 370 }
371 371
372 } // namespace url_formatter 372 } // namespace url_formatter
OLDNEW
« no previous file with comments | « components/url_formatter/elide_url.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698