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

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

Issue 613733002: Enabled CORS for chrome://resources. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fixed nits Created 6 years, 2 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
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 "base/logging.h" 7 #include "base/logging.h"
8 #include "base/memory/ref_counted_memory.h" 8 #include "base/memory/ref_counted_memory.h"
9 #include "base/strings/string_util.h" 9 #include "base/strings/string_util.h"
10 #include "base/threading/thread_restrictions.h" 10 #include "base/threading/thread_restrictions.h"
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
82 std::string SharedResourcesDataSource::GetMimeType( 82 std::string SharedResourcesDataSource::GetMimeType(
83 const std::string& path) const { 83 const std::string& path) const {
84 // Requests should not block on the disk! On POSIX this goes to disk. 84 // Requests should not block on the disk! On POSIX this goes to disk.
85 // http://code.google.com/p/chromium/issues/detail?id=59849 85 // http://code.google.com/p/chromium/issues/detail?id=59849
86 86
87 base::ThreadRestrictions::ScopedAllowIO allow_io; 87 base::ThreadRestrictions::ScopedAllowIO allow_io;
88 std::string mime_type; 88 std::string mime_type;
89 net::GetMimeTypeFromFile(base::FilePath().AppendASCII(path), &mime_type); 89 net::GetMimeTypeFromFile(base::FilePath().AppendASCII(path), &mime_type);
90 return mime_type; 90 return mime_type;
91 } 91 }
92
93 std::string
94 SharedResourcesDataSource::GetAccessControlAllowOriginForOrigin(
95 const std::string& origin) const {
96 std::string allowed_origin_prefix = content::kChromeUIScheme;
Charlie Reis 2014/10/06 19:43:20 nit: Let's put a comment here saying that we're in
dzhioev (left Google) 2014/10/08 18:41:56 Done.
97 allowed_origin_prefix += "://";
98 if (origin.find(allowed_origin_prefix) != 0)
99 return "none";
100 return origin;
101 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698