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

Unified Diff: extensions/browser/api/web_request/web_request_permissions.cc

Issue 2579473002: [wip] Add LiteralStringPiece which templatizes based on character length (Closed)
Patch Set: add some usage Created 4 years 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
« no previous file with comments | « base/strings/string_piece_unittest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: extensions/browser/api/web_request/web_request_permissions.cc
diff --git a/extensions/browser/api/web_request/web_request_permissions.cc b/extensions/browser/api/web_request/web_request_permissions.cc
index 11e8c9d1054ae421e7a14d0b209c8610959e574f..d241f515e76d81c8a01fccf97f5bd9ef7898b2fe 100644
--- a/extensions/browser/api/web_request/web_request_permissions.cc
+++ b/extensions/browser/api/web_request/web_request_permissions.cc
@@ -50,7 +50,7 @@ bool IsSensitiveURL(const GURL& url) {
const base::StringPiece& host = url.host_piece();
const char kGoogleCom[] = "google.com";
const char kClient[] = "clients";
- if (url.DomainIs(kGoogleCom)) {
+ if (url.DomainIs(base::LiteralStringPiece(kGoogleCom))) {
// Check for "clients[0-9]*.google.com" hosts.
// This protects requests to several internal services such as sync,
// extension update pings, captive portal detection, fraudulent certificate
@@ -70,12 +70,13 @@ bool IsSensitiveURL(const GURL& url) {
}
// This protects requests to safe browsing, link doctor, and possibly
// others.
- sensitive_chrome_url = sensitive_chrome_url ||
- url.DomainIs("clients.google.com") ||
- url.DomainIs("sb-ssl.google.com") ||
- (url.DomainIs("chrome.google.com") &&
- base::StartsWith(url.path_piece(), "/webstore",
- base::CompareCase::SENSITIVE));
+ sensitive_chrome_url =
+ sensitive_chrome_url ||
+ url.DomainIs(base::LiteralStringPiece("clients.google.com")) ||
+ url.DomainIs(base::LiteralStringPiece("sb-ssl.google.com")) ||
+ (url.DomainIs(base::LiteralStringPiece("chrome.google.com")) &&
+ base::StartsWith(url.path_piece(), "/webstore",
+ base::CompareCase::SENSITIVE));
}
return sensitive_chrome_url || extension_urls::IsWebstoreUpdateUrl(url) ||
extension_urls::IsBlacklistUpdateUrl(url);
« no previous file with comments | « base/strings/string_piece_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698