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 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
389 return; // The scheme has already been whitelisted for every child process. | 389 return; // The scheme has already been whitelisted for every child process. |
390 | 390 |
391 if (IsPseudoScheme(url.scheme())) { | 391 if (IsPseudoScheme(url.scheme())) { |
392 // The view-source scheme is a special case of a pseudo-URL that eventually | 392 // The view-source scheme is a special case of a pseudo-URL that eventually |
393 // results in requesting its embedded URL. | 393 // results in requesting its embedded URL. |
394 if (url.SchemeIs(kViewSourceScheme)) { | 394 if (url.SchemeIs(kViewSourceScheme)) { |
395 // URLs with the view-source scheme typically look like: | 395 // URLs with the view-source scheme typically look like: |
396 // view-source:http://www.google.com/a | 396 // view-source:http://www.google.com/a |
397 // In order to request these URLs, the child_id needs to be able to | 397 // In order to request these URLs, the child_id needs to be able to |
398 // request the embedded URL. | 398 // request the embedded URL. |
399 GrantRequestURL(child_id, GURL(url.path())); | 399 GrantRequestURL(child_id, GURL(url.GetContent())); |
400 } | 400 } |
401 | 401 |
402 return; // Can't grant the capability to request pseudo schemes. | 402 return; // Can't grant the capability to request pseudo schemes. |
403 } | 403 } |
404 | 404 |
405 { | 405 { |
406 base::AutoLock lock(lock_); | 406 base::AutoLock lock(lock_); |
407 SecurityStateMap::iterator state = security_state_.find(child_id); | 407 SecurityStateMap::iterator state = security_state_.find(child_id); |
408 if (state == security_state_.end()) | 408 if (state == security_state_.end()) |
409 return; | 409 return; |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
579 | 579 |
580 if (IsWebSafeScheme(url.scheme())) | 580 if (IsWebSafeScheme(url.scheme())) |
581 return true; // The scheme has been white-listed for every child process. | 581 return true; // The scheme has been white-listed for every child process. |
582 | 582 |
583 if (IsPseudoScheme(url.scheme())) { | 583 if (IsPseudoScheme(url.scheme())) { |
584 // There are a number of special cases for pseudo schemes. | 584 // There are a number of special cases for pseudo schemes. |
585 | 585 |
586 if (url.SchemeIs(kViewSourceScheme)) { | 586 if (url.SchemeIs(kViewSourceScheme)) { |
587 // A view-source URL is allowed if the child process is permitted to | 587 // A view-source URL is allowed if the child process is permitted to |
588 // request the embedded URL. Careful to avoid pointless recursion. | 588 // request the embedded URL. Careful to avoid pointless recursion. |
589 GURL child_url(url.path()); | 589 GURL child_url(url.GetContent()); |
590 if (child_url.SchemeIs(kViewSourceScheme) && | 590 if (child_url.SchemeIs(kViewSourceScheme) && |
591 url.SchemeIs(kViewSourceScheme)) | 591 url.SchemeIs(kViewSourceScheme)) |
592 return false; | 592 return false; |
593 | 593 |
594 return CanRequestURL(child_id, child_url); | 594 return CanRequestURL(child_id, child_url); |
595 } | 595 } |
596 | 596 |
597 if (LowerCaseEqualsASCII(url.spec(), kAboutBlankURL)) | 597 if (LowerCaseEqualsASCII(url.spec(), kAboutBlankURL)) |
598 return true; // Every child process can request <about:blank>. | 598 return true; // Every child process can request <about:blank>. |
599 | 599 |
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
867 base::AutoLock lock(lock_); | 867 base::AutoLock lock(lock_); |
868 | 868 |
869 SecurityStateMap::iterator state = security_state_.find(child_id); | 869 SecurityStateMap::iterator state = security_state_.find(child_id); |
870 if (state == security_state_.end()) | 870 if (state == security_state_.end()) |
871 return false; | 871 return false; |
872 | 872 |
873 return state->second->can_send_midi_sysex(); | 873 return state->second->can_send_midi_sysex(); |
874 } | 874 } |
875 | 875 |
876 } // namespace content | 876 } // namespace content |
OLD | NEW |