| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "webkit/browser/fileapi/sandbox_file_system_backend_delegate.h" | 5 #include "webkit/browser/fileapi/sandbox_file_system_backend_delegate.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
| 9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
| 10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 174 base::FilePath::StringType::npos) | 174 base::FilePath::StringType::npos) |
| 175 return false; | 175 return false; |
| 176 } | 176 } |
| 177 | 177 |
| 178 return true; | 178 return true; |
| 179 } | 179 } |
| 180 | 180 |
| 181 bool SandboxFileSystemBackendDelegate::IsAllowedScheme(const GURL& url) const { | 181 bool SandboxFileSystemBackendDelegate::IsAllowedScheme(const GURL& url) const { |
| 182 // Basically we only accept http or https. We allow file:// URLs | 182 // Basically we only accept http or https. We allow file:// URLs |
| 183 // only if --allow-file-access-from-files flag is given. | 183 // only if --allow-file-access-from-files flag is given. |
| 184 if (url.SchemeIs("http") || url.SchemeIs("https")) | 184 if (url.SchemeIsHttp()) |
| 185 return true; | 185 return true; |
| 186 if (url.SchemeIsFileSystem()) | 186 if (url.SchemeIsFileSystem()) |
| 187 return url.inner_url() && IsAllowedScheme(*url.inner_url()); | 187 return url.inner_url() && IsAllowedScheme(*url.inner_url()); |
| 188 | 188 |
| 189 for (size_t i = 0; | 189 for (size_t i = 0; |
| 190 i < file_system_options_.additional_allowed_schemes().size(); | 190 i < file_system_options_.additional_allowed_schemes().size(); |
| 191 ++i) { | 191 ++i) { |
| 192 if (url.SchemeIs( | 192 if (url.SchemeIs( |
| 193 file_system_options_.additional_allowed_schemes()[i].c_str())) | 193 file_system_options_.additional_allowed_schemes()[i].c_str())) |
| 194 return true; | 194 return true; |
| (...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 433 break; | 433 break; |
| 434 } | 434 } |
| 435 #undef REPORT | 435 #undef REPORT |
| 436 } | 436 } |
| 437 | 437 |
| 438 ObfuscatedFileUtil* SandboxFileSystemBackendDelegate::obfuscated_file_util() { | 438 ObfuscatedFileUtil* SandboxFileSystemBackendDelegate::obfuscated_file_util() { |
| 439 return static_cast<ObfuscatedFileUtil*>(sync_file_util()); | 439 return static_cast<ObfuscatedFileUtil*>(sync_file_util()); |
| 440 } | 440 } |
| 441 | 441 |
| 442 } // namespace fileapi | 442 } // namespace fileapi |
| OLD | NEW |