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

Unified Diff: extensions/browser/url_request_util.cc

Issue 2481923002: [WIP] make GURL::path() return a StringPiece (Closed)
Patch Set: thanks asan Created 4 years, 1 month 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 | « extensions/browser/info_map.cc ('k') | extensions/common/file_util.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: extensions/browser/url_request_util.cc
diff --git a/extensions/browser/url_request_util.cc b/extensions/browser/url_request_util.cc
index 28d863389078857b11a65b32410543a20e7d433a..95b9131c7749b7ec1547226a5b000bc2ffefa579 100644
--- a/extensions/browser/url_request_util.cc
+++ b/extensions/browser/url_request_util.cc
@@ -28,7 +28,7 @@ bool AllowCrossRendererResourceLoad(net::URLRequest* request,
bool* allowed) {
const content::ResourceRequestInfo* info =
content::ResourceRequestInfo::ForRequest(request);
- std::string resource_path = request->url().path();
+ base::StringPiece resource_path = request->url().path();
// PlzNavigate: this logic is performed for main frame requests in
// ExtensionNavigationThrottle::WillStartRequest.
@@ -49,8 +49,8 @@ bool AllowCrossRendererResourceLoad(net::URLRequest* request,
info->GetChildID(), &partition_id);
if (AllowCrossRendererResourceLoadHelper(
- is_guest, extension, owner_extension, partition_id, resource_path,
- info->GetPageTransition(), allowed)) {
+ is_guest, extension, owner_extension, partition_id,
+ resource_path.as_string(), info->GetPageTransition(), allowed)) {
return true;
}
}
@@ -68,8 +68,9 @@ bool AllowCrossRendererResourceLoad(net::URLRequest* request,
// some extensions want to be able to do things like create their own
// launchers.
std::string resource_root_relative_path =
- request->url().path().empty() ? std::string()
- : request->url().path().substr(1);
+ request->url().path().empty()
+ ? std::string()
+ : request->url().path().substr(1).as_string();
if (extension->is_hosted_app() &&
!IconsInfo::GetIcons(extension)
.ContainsPath(resource_root_relative_path)) {
@@ -103,8 +104,8 @@ bool AllowCrossRendererResourceLoad(net::URLRequest* request,
}
// Also allow if the file is explicitly listed as a web_accessible_resource.
- if (WebAccessibleResourcesInfo::IsResourceWebAccessible(extension,
- resource_path)) {
+ if (WebAccessibleResourcesInfo::IsResourceWebAccessible(
+ extension, resource_path.as_string())) {
*allowed = true;
return true;
}
« no previous file with comments | « extensions/browser/info_map.cc ('k') | extensions/common/file_util.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698