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 "webkit/fileapi/sandbox_mount_point_provider.h" | 5 #include "webkit/fileapi/sandbox_mount_point_provider.h" |
6 | 6 |
7 #include "base/bind.h" | 7 #include "base/bind.h" |
8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
(...skipping 633 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
644 return FilePath(); | 644 return FilePath(); |
645 | 645 |
646 return root; | 646 return root; |
647 } | 647 } |
648 | 648 |
649 bool SandboxMountPointProvider::IsAllowedScheme(const GURL& url) const { | 649 bool SandboxMountPointProvider::IsAllowedScheme(const GURL& url) const { |
650 // Basically we only accept http or https. We allow file:// URLs | 650 // Basically we only accept http or https. We allow file:// URLs |
651 // only if --allow-file-access-from-files flag is given. | 651 // only if --allow-file-access-from-files flag is given. |
652 if (url.SchemeIs("http") || url.SchemeIs("https")) | 652 if (url.SchemeIs("http") || url.SchemeIs("https")) |
653 return true; | 653 return true; |
| 654 if (url.SchemeIsFileSystem()) |
| 655 return url.inner_url() && IsAllowedScheme(*url.inner_url()); |
| 656 |
654 for (size_t i = 0; | 657 for (size_t i = 0; |
655 i < file_system_options_.additional_allowed_schemes().size(); | 658 i < file_system_options_.additional_allowed_schemes().size(); |
656 ++i) { | 659 ++i) { |
657 if (url.SchemeIs( | 660 if (url.SchemeIs( |
658 file_system_options_.additional_allowed_schemes()[i].c_str())) | 661 file_system_options_.additional_allowed_schemes()[i].c_str())) |
659 return true; | 662 return true; |
660 } | 663 } |
661 return false; | 664 return false; |
662 } | 665 } |
663 | 666 |
664 } // namespace fileapi | 667 } // namespace fileapi |
OLD | NEW |