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