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/child_process_security_policy_impl.h" | 5 #include "content/browser/child_process_security_policy_impl.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <utility> | 8 #include <utility> |
9 | 9 |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 12 matching lines...) Expand all Loading... |
23 #include "content/public/browser/render_process_host.h" | 23 #include "content/public/browser/render_process_host.h" |
24 #include "content/public/common/bindings_policy.h" | 24 #include "content/public/common/bindings_policy.h" |
25 #include "content/public/common/url_constants.h" | 25 #include "content/public/common/url_constants.h" |
26 #include "net/base/filename_util.h" | 26 #include "net/base/filename_util.h" |
27 #include "net/url_request/url_request.h" | 27 #include "net/url_request/url_request.h" |
28 #include "storage/browser/fileapi/file_permission_policy.h" | 28 #include "storage/browser/fileapi/file_permission_policy.h" |
29 #include "storage/browser/fileapi/file_system_url.h" | 29 #include "storage/browser/fileapi/file_system_url.h" |
30 #include "storage/browser/fileapi/isolated_context.h" | 30 #include "storage/browser/fileapi/isolated_context.h" |
31 #include "storage/common/fileapi/file_system_util.h" | 31 #include "storage/common/fileapi/file_system_util.h" |
32 #include "url/gurl.h" | 32 #include "url/gurl.h" |
33 #include "url/url_util.h" | |
34 | 33 |
35 namespace content { | 34 namespace content { |
36 | 35 |
37 namespace { | 36 namespace { |
38 | 37 |
39 // Used internally only. These bit positions have no relationship to any | 38 // Used internally only. These bit positions have no relationship to any |
40 // underlying OS and can be changed to accommodate finer-grained permissions. | 39 // underlying OS and can be changed to accommodate finer-grained permissions. |
41 enum ChildProcessSecurityPermissions { | 40 enum ChildProcessSecurityPermissions { |
42 READ_FILE_PERMISSION = 1 << 0, | 41 READ_FILE_PERMISSION = 1 << 0, |
43 WRITE_FILE_PERMISSION = 1 << 1, | 42 WRITE_FILE_PERMISSION = 1 << 1, |
(...skipping 578 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
622 } | 621 } |
623 | 622 |
624 bool ChildProcessSecurityPolicyImpl::CanRequestURL( | 623 bool ChildProcessSecurityPolicyImpl::CanRequestURL( |
625 int child_id, const GURL& url) { | 624 int child_id, const GURL& url) { |
626 if (!url.is_valid()) | 625 if (!url.is_valid()) |
627 return false; // Can't request invalid URLs. | 626 return false; // Can't request invalid URLs. |
628 | 627 |
629 if (IsPseudoScheme(url.scheme())) { | 628 if (IsPseudoScheme(url.scheme())) { |
630 // Every child process can request <about:blank>, <about:blank?foo>, | 629 // Every child process can request <about:blank>, <about:blank?foo>, |
631 // <about:blank/#foo> and <about:srcdoc>. | 630 // <about:blank/#foo> and <about:srcdoc>. |
632 if (url::IsAboutBlank(url) || url == kAboutSrcDocURL) | 631 if (url.IsAboutBlank() || url == kAboutSrcDocURL) |
633 return true; | 632 return true; |
634 // URLs like <about:version>, <about:crash>, <view-source:...> shouldn't be | 633 // URLs like <about:version>, <about:crash>, <view-source:...> shouldn't be |
635 // requestable by any child process. Also, this case covers | 634 // requestable by any child process. Also, this case covers |
636 // <javascript:...>, which should be handled internally by the process and | 635 // <javascript:...>, which should be handled internally by the process and |
637 // not kicked up to the browser. | 636 // not kicked up to the browser. |
638 return false; | 637 return false; |
639 } | 638 } |
640 | 639 |
641 // Blob and filesystem URLs require special treatment, since they embed an | 640 // Blob and filesystem URLs require special treatment, since they embed an |
642 // inner origin. | 641 // inner origin. |
(...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1000 base::AutoLock lock(lock_); | 999 base::AutoLock lock(lock_); |
1001 | 1000 |
1002 SecurityStateMap::iterator state = security_state_.find(child_id); | 1001 SecurityStateMap::iterator state = security_state_.find(child_id); |
1003 if (state == security_state_.end()) | 1002 if (state == security_state_.end()) |
1004 return false; | 1003 return false; |
1005 | 1004 |
1006 return state->second->can_send_midi_sysex(); | 1005 return state->second->can_send_midi_sysex(); |
1007 } | 1006 } |
1008 | 1007 |
1009 } // namespace content | 1008 } // namespace content |
OLD | NEW |