| 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 626 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 637 return false; | 637 return false; |
| 638 } | 638 } |
| 639 | 639 |
| 640 // Blob and filesystem URLs require special treatment, since they embed an | 640 // Blob and filesystem URLs require special treatment, since they embed an |
| 641 // inner origin. | 641 // inner origin. |
| 642 if (url.SchemeIsBlob() || url.SchemeIsFileSystem()) { | 642 if (url.SchemeIsBlob() || url.SchemeIsFileSystem()) { |
| 643 if (IsMalformedBlobUrl(url)) | 643 if (IsMalformedBlobUrl(url)) |
| 644 return false; | 644 return false; |
| 645 | 645 |
| 646 url::Origin origin(url); | 646 url::Origin origin(url); |
| 647 return origin.unique() || IsWebSafeScheme(origin.scheme()) || | 647 return origin.opaque() || IsWebSafeScheme(origin.scheme()) || |
| 648 CanCommitURL(child_id, GURL(origin.Serialize())); | 648 CanCommitURL(child_id, GURL(origin.Serialize())); |
| 649 } | 649 } |
| 650 | 650 |
| 651 if (IsWebSafeScheme(url.scheme())) | 651 if (IsWebSafeScheme(url.scheme())) |
| 652 return true; | 652 return true; |
| 653 | 653 |
| 654 // If the process can commit the URL, it can request it. | 654 // If the process can commit the URL, it can request it. |
| 655 if (CanCommitURL(child_id, url)) | 655 if (CanCommitURL(child_id, url)) |
| 656 return true; | 656 return true; |
| 657 | 657 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 670 if (IsPseudoScheme(url.scheme())) | 670 if (IsPseudoScheme(url.scheme())) |
| 671 return url == url::kAboutBlankURL || url == kAboutSrcDocURL; | 671 return url == url::kAboutBlankURL || url == kAboutSrcDocURL; |
| 672 | 672 |
| 673 // Blob and filesystem URLs require special treatment; validate the inner | 673 // Blob and filesystem URLs require special treatment; validate the inner |
| 674 // origin they embed. | 674 // origin they embed. |
| 675 if (url.SchemeIsBlob() || url.SchemeIsFileSystem()) { | 675 if (url.SchemeIsBlob() || url.SchemeIsFileSystem()) { |
| 676 if (IsMalformedBlobUrl(url)) | 676 if (IsMalformedBlobUrl(url)) |
| 677 return false; | 677 return false; |
| 678 | 678 |
| 679 url::Origin origin(url); | 679 url::Origin origin(url); |
| 680 return origin.unique() || CanCommitURL(child_id, GURL(origin.Serialize())); | 680 return origin.opaque() || CanCommitURL(child_id, GURL(origin.Serialize())); |
| 681 } | 681 } |
| 682 | 682 |
| 683 { | 683 { |
| 684 base::AutoLock lock(lock_); | 684 base::AutoLock lock(lock_); |
| 685 | 685 |
| 686 // Most schemes can commit in any process. Note that we check | 686 // Most schemes can commit in any process. Note that we check |
| 687 // schemes_okay_to_commit_in_any_process_ here, which is stricter than | 687 // schemes_okay_to_commit_in_any_process_ here, which is stricter than |
| 688 // IsWebSafeScheme(). | 688 // IsWebSafeScheme(). |
| 689 // | 689 // |
| 690 // TODO(creis, nick): https://crbug.com/515309: in generalized Site | 690 // TODO(creis, nick): https://crbug.com/515309: in generalized Site |
| (...skipping 308 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 999 base::AutoLock lock(lock_); | 999 base::AutoLock lock(lock_); |
| 1000 | 1000 |
| 1001 SecurityStateMap::iterator state = security_state_.find(child_id); | 1001 SecurityStateMap::iterator state = security_state_.find(child_id); |
| 1002 if (state == security_state_.end()) | 1002 if (state == security_state_.end()) |
| 1003 return false; | 1003 return false; |
| 1004 | 1004 |
| 1005 return state->second->can_send_midi_sysex(); | 1005 return state->second->can_send_midi_sysex(); |
| 1006 } | 1006 } |
| 1007 | 1007 |
| 1008 } // namespace content | 1008 } // namespace content |
| OLD | NEW |