OLD | NEW |
---|---|
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 Loading... | |
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 } | |
OLD | NEW |