| 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 619 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 630 return FilePath(); | 630 return FilePath(); |
| 631 | 631 |
| 632 return root; | 632 return root; |
| 633 } | 633 } |
| 634 | 634 |
| 635 bool SandboxMountPointProvider::IsAllowedScheme(const GURL& url) const { | 635 bool SandboxMountPointProvider::IsAllowedScheme(const GURL& url) const { |
| 636 // Basically we only accept http or https. We allow file:// URLs | 636 // Basically we only accept http or https. We allow file:// URLs |
| 637 // only if --allow-file-access-from-files flag is given. | 637 // only if --allow-file-access-from-files flag is given. |
| 638 if (url.SchemeIs("http") || url.SchemeIs("https")) | 638 if (url.SchemeIs("http") || url.SchemeIs("https")) |
| 639 return true; | 639 return true; |
| 640 if (url.SchemeIsFileSystem() && url.inner_url()) |
| 641 return IsAllowedScheme(*url.inner_url()); |
| 642 |
| 640 for (size_t i = 0; | 643 for (size_t i = 0; |
| 641 i < file_system_options_.additional_allowed_schemes().size(); | 644 i < file_system_options_.additional_allowed_schemes().size(); |
| 642 ++i) { | 645 ++i) { |
| 643 if (url.SchemeIs( | 646 if (url.SchemeIs( |
| 644 file_system_options_.additional_allowed_schemes()[i].c_str())) | 647 file_system_options_.additional_allowed_schemes()[i].c_str())) |
| 645 return true; | 648 return true; |
| 646 } | 649 } |
| 647 return false; | 650 return false; |
| 648 } | 651 } |
| 649 | 652 |
| 650 } // namespace fileapi | 653 } // namespace fileapi |
| OLD | NEW |