| 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 "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/files/file_path.h" | 8 #include "base/files/file_path.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/metrics/histogram.h" | 10 #include "base/metrics/histogram.h" |
| (...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 387 return; // The scheme has already been whitelisted for every child process. | 387 return; // The scheme has already been whitelisted for every child process. |
| 388 | 388 |
| 389 if (IsPseudoScheme(url.scheme())) { | 389 if (IsPseudoScheme(url.scheme())) { |
| 390 // The view-source scheme is a special case of a pseudo-URL that eventually | 390 // The view-source scheme is a special case of a pseudo-URL that eventually |
| 391 // results in requesting its embedded URL. | 391 // results in requesting its embedded URL. |
| 392 if (url.SchemeIs(kViewSourceScheme)) { | 392 if (url.SchemeIs(kViewSourceScheme)) { |
| 393 // URLs with the view-source scheme typically look like: | 393 // URLs with the view-source scheme typically look like: |
| 394 // view-source:http://www.google.com/a | 394 // view-source:http://www.google.com/a |
| 395 // In order to request these URLs, the child_id needs to be able to | 395 // In order to request these URLs, the child_id needs to be able to |
| 396 // request the embedded URL. | 396 // request the embedded URL. |
| 397 GrantRequestURL(child_id, GURL(url.path())); | 397 GrantRequestURL(child_id, GURL(url.Content())); |
| 398 } | 398 } |
| 399 | 399 |
| 400 return; // Can't grant the capability to request pseudo schemes. | 400 return; // Can't grant the capability to request pseudo schemes. |
| 401 } | 401 } |
| 402 | 402 |
| 403 { | 403 { |
| 404 base::AutoLock lock(lock_); | 404 base::AutoLock lock(lock_); |
| 405 SecurityStateMap::iterator state = security_state_.find(child_id); | 405 SecurityStateMap::iterator state = security_state_.find(child_id); |
| 406 if (state == security_state_.end()) | 406 if (state == security_state_.end()) |
| 407 return; | 407 return; |
| (...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 577 | 577 |
| 578 if (IsWebSafeScheme(url.scheme())) | 578 if (IsWebSafeScheme(url.scheme())) |
| 579 return true; // The scheme has been white-listed for every child process. | 579 return true; // The scheme has been white-listed for every child process. |
| 580 | 580 |
| 581 if (IsPseudoScheme(url.scheme())) { | 581 if (IsPseudoScheme(url.scheme())) { |
| 582 // There are a number of special cases for pseudo schemes. | 582 // There are a number of special cases for pseudo schemes. |
| 583 | 583 |
| 584 if (url.SchemeIs(kViewSourceScheme)) { | 584 if (url.SchemeIs(kViewSourceScheme)) { |
| 585 // A view-source URL is allowed if the child process is permitted to | 585 // A view-source URL is allowed if the child process is permitted to |
| 586 // request the embedded URL. Careful to avoid pointless recursion. | 586 // request the embedded URL. Careful to avoid pointless recursion. |
| 587 GURL child_url(url.path()); | 587 GURL child_url(url.Content()); |
| 588 if (child_url.SchemeIs(kViewSourceScheme) && | 588 if (child_url.SchemeIs(kViewSourceScheme) && |
| 589 url.SchemeIs(kViewSourceScheme)) | 589 url.SchemeIs(kViewSourceScheme)) |
| 590 return false; | 590 return false; |
| 591 | 591 |
| 592 return CanRequestURL(child_id, child_url); | 592 return CanRequestURL(child_id, child_url); |
| 593 } | 593 } |
| 594 | 594 |
| 595 if (LowerCaseEqualsASCII(url.spec(), kAboutBlankURL)) | 595 if (LowerCaseEqualsASCII(url.spec(), kAboutBlankURL)) |
| 596 return true; // Every child process can request <about:blank>. | 596 return true; // Every child process can request <about:blank>. |
| 597 | 597 |
| (...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 854 base::AutoLock lock(lock_); | 854 base::AutoLock lock(lock_); |
| 855 | 855 |
| 856 SecurityStateMap::iterator state = security_state_.find(child_id); | 856 SecurityStateMap::iterator state = security_state_.find(child_id); |
| 857 if (state == security_state_.end()) | 857 if (state == security_state_.end()) |
| 858 return false; | 858 return false; |
| 859 | 859 |
| 860 return state->second->can_send_midi_sysex(); | 860 return state->second->can_send_midi_sysex(); |
| 861 } | 861 } |
| 862 | 862 |
| 863 } // namespace content | 863 } // namespace content |
| OLD | NEW |