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

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

Issue 2476433002: Replace URLDataSource::MessageLoopForRequestPath() with TaskRunnerForRequestPath(). (Closed)
Patch Set: rebase off local branch 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 unified diff | Download patch
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 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 if (extension == "svg") 138 if (extension == "svg")
139 return "image/svg+xml"; 139 return "image/svg+xml";
140 140
141 if (extension == "woff2") 141 if (extension == "woff2")
142 return "application/font-woff2"; 142 return "application/font-woff2";
143 143
144 NOTREACHED() << path; 144 NOTREACHED() << path;
145 return "text/plain"; 145 return "text/plain";
146 } 146 }
147 147
148 base::MessageLoop* SharedResourcesDataSource::MessageLoopForRequestPath( 148 scoped_refptr<base::SingleThreadTaskRunner>
149 SharedResourcesDataSource::TaskRunnerForRequestPath(
149 const std::string& path) const { 150 const std::string& path) const {
150 return nullptr; 151 return nullptr;
151 } 152 }
152 153
153 std::string 154 std::string
154 SharedResourcesDataSource::GetAccessControlAllowOriginForOrigin( 155 SharedResourcesDataSource::GetAccessControlAllowOriginForOrigin(
155 const std::string& origin) const { 156 const std::string& origin) const {
156 // For now we give access only for "chrome://*" origins. 157 // For now we give access only for "chrome://*" origins.
157 // 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
158 // 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|
159 // back. 160 // back.
160 std::string allowed_origin_prefix = kChromeUIScheme; 161 std::string allowed_origin_prefix = kChromeUIScheme;
161 allowed_origin_prefix += "://"; 162 allowed_origin_prefix += "://";
162 if (!base::StartsWith(origin, allowed_origin_prefix, 163 if (!base::StartsWith(origin, allowed_origin_prefix,
163 base::CompareCase::SENSITIVE)) { 164 base::CompareCase::SENSITIVE)) {
164 return "null"; 165 return "null";
165 } 166 }
166 return origin; 167 return origin;
167 } 168 }
168 169
169 } // namespace content 170 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/webui/shared_resources_data_source.h ('k') | content/browser/webui/url_data_manager_backend.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698