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

Side by Side Diff: extensions/browser/url_request_util.cc

Issue 2626923002: Make ExtensionIconSet::ContainsPath use StringPiece. (Closed)
Patch Set: Created 3 years, 11 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 | « extensions/browser/extension_protocols.cc ('k') | extensions/common/BUILD.gn » ('j') | 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 "extensions/browser/url_request_util.h" 5 #include "extensions/browser/url_request_util.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "content/public/browser/resource_request_info.h" 9 #include "content/public/browser/resource_request_info.h"
10 #include "content/public/common/browser_side_navigation_policy.h" 10 #include "content/public/common/browser_side_navigation_policy.h"
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 // checks. 60 // checks.
61 if (!extension) { 61 if (!extension) {
62 *allowed = true; 62 *allowed = true;
63 return true; 63 return true;
64 } 64 }
65 65
66 // Disallow loading of packaged resources for hosted apps. We don't allow 66 // Disallow loading of packaged resources for hosted apps. We don't allow
67 // hybrid hosted/packaged apps. The one exception is access to icons, since 67 // hybrid hosted/packaged apps. The one exception is access to icons, since
68 // some extensions want to be able to do things like create their own 68 // some extensions want to be able to do things like create their own
69 // launchers. 69 // launchers.
70 std::string resource_root_relative_path = 70 base::StringPiece resource_root_relative_path =
71 request->url().path().empty() ? std::string() 71 request->url().path_piece().empty()
72 : request->url().path().substr(1); 72 ? base::StringPiece()
73 : request->url().path_piece().substr(1);
73 if (extension->is_hosted_app() && 74 if (extension->is_hosted_app() &&
74 !IconsInfo::GetIcons(extension) 75 !IconsInfo::GetIcons(extension)
75 .ContainsPath(resource_root_relative_path)) { 76 .ContainsPath(resource_root_relative_path)) {
76 LOG(ERROR) << "Denying load of " << request->url().spec() << " from " 77 LOG(ERROR) << "Denying load of " << request->url().spec() << " from "
77 << "hosted app."; 78 << "hosted app.";
78 *allowed = false; 79 *allowed = false;
79 return true; 80 return true;
80 } 81 }
81 82
82 DCHECK_EQ(extension->url(), request->url().GetWithEmptyPath()); 83 DCHECK_EQ(extension->url(), request->url().GetWithEmptyPath());
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 if (is_guest && !ui::PageTransitionIsWebTriggerable(page_transition)) { 164 if (is_guest && !ui::PageTransitionIsWebTriggerable(page_transition)) {
164 *allowed = false; 165 *allowed = false;
165 return true; 166 return true;
166 } 167 }
167 168
168 return false; 169 return false;
169 } 170 }
170 171
171 } // namespace url_request_util 172 } // namespace url_request_util
172 } // namespace extensions 173 } // namespace extensions
OLDNEW
« no previous file with comments | « extensions/browser/extension_protocols.cc ('k') | extensions/common/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698