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

Side by Side Diff: content/browser/webui/shared_resources_data_source.cc

Issue 2137503002: Revert of Replace string::find(prefix) == 0 pattern with base::StartsWith(). (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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 | « content/browser/iframe_zoom_browsertest.cc ('k') | media/blink/buffered_resource_loader.cc » ('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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "content/browser/webui/shared_resources_data_source.h" 5 #include "content/browser/webui/shared_resources_data_source.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/containers/hash_tables.h" 9 #include "base/containers/hash_tables.h"
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
153 153
154 std::string 154 std::string
155 SharedResourcesDataSource::GetAccessControlAllowOriginForOrigin( 155 SharedResourcesDataSource::GetAccessControlAllowOriginForOrigin(
156 const std::string& origin) const { 156 const std::string& origin) const {
157 // For now we give access only for "chrome://*" origins. 157 // For now we give access only for "chrome://*" origins.
158 // According to CORS spec, Access-Control-Allow-Origin header doesn't support 158 // According to CORS spec, Access-Control-Allow-Origin header doesn't support
159 // wildcards, so we need to set its value explicitly by passing the |origin| 159 // wildcards, so we need to set its value explicitly by passing the |origin|
160 // back. 160 // back.
161 std::string allowed_origin_prefix = kChromeUIScheme; 161 std::string allowed_origin_prefix = kChromeUIScheme;
162 allowed_origin_prefix += "://"; 162 allowed_origin_prefix += "://";
163 if (!base::StartsWith(origin, allowed_origin_prefix, 163 if (origin.find(allowed_origin_prefix) != 0)
164 base::CompareCase::SENSITIVE)) {
165 return "null"; 164 return "null";
166 }
167 return origin; 165 return origin;
168 } 166 }
169 167
170 } // namespace content 168 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/iframe_zoom_browsertest.cc ('k') | media/blink/buffered_resource_loader.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698