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 "chrome/browser/chrome_content_browser_client.h" | 5 #include "chrome/browser/chrome_content_browser_client.h" |
6 | 6 |
7 #include <set> | 7 #include <set> |
8 #include <utility> | 8 #include <utility> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 2489 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2500 if (IsExtensionOrSharedModuleWhitelisted(url, extension_set, | 2500 if (IsExtensionOrSharedModuleWhitelisted(url, extension_set, |
2501 allowed_socket_origins_)) { | 2501 allowed_socket_origins_)) { |
2502 return true; | 2502 return true; |
2503 } | 2503 } |
2504 } else { | 2504 } else { |
2505 // Access to public socket APIs is controlled by extension permissions. | 2505 // Access to public socket APIs is controlled by extension permissions. |
2506 if (url.is_valid() && url.SchemeIs(extensions::kExtensionScheme) && | 2506 if (url.is_valid() && url.SchemeIs(extensions::kExtensionScheme) && |
2507 extension_set) { | 2507 extension_set) { |
2508 const Extension* extension = extension_set->GetByID(url.host()); | 2508 const Extension* extension = extension_set->GetByID(url.host()); |
2509 if (extension) { | 2509 if (extension) { |
| 2510 const extensions::PermissionsData* permissions_data = |
| 2511 extensions::PermissionsData::ForExtension(extension); |
2510 if (params) { | 2512 if (params) { |
2511 extensions::SocketPermission::CheckParam check_params( | 2513 extensions::SocketPermission::CheckParam check_params( |
2512 params->type, params->host, params->port); | 2514 params->type, params->host, params->port); |
2513 if (extensions::PermissionsData::CheckAPIPermissionWithParam( | 2515 if (permissions_data->CheckAPIPermissionWithParam( |
2514 extension, extensions::APIPermission::kSocket, | 2516 extensions::APIPermission::kSocket, &check_params)) { |
2515 &check_params)) { | |
2516 return true; | 2517 return true; |
2517 } | 2518 } |
2518 } else { | 2519 } else if (permissions_data->HasAPIPermission( |
2519 if (extensions::PermissionsData::HasAPIPermission( | 2520 extensions::APIPermission::kSocket)) { |
2520 extension, extensions::APIPermission::kSocket)) { | 2521 return true; |
2521 return true; | |
2522 } | |
2523 } | 2522 } |
2524 } | 2523 } |
2525 } | 2524 } |
2526 } | 2525 } |
2527 | 2526 |
2528 // Allow both public and private APIs if the command line says so. | 2527 // Allow both public and private APIs if the command line says so. |
2529 return IsHostAllowedByCommandLine(url, extension_set, | 2528 return IsHostAllowedByCommandLine(url, extension_set, |
2530 switches::kAllowNaClSocketAPI); | 2529 switches::kAllowNaClSocketAPI); |
2531 #else | 2530 #else |
2532 return false; | 2531 return false; |
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2757 switches::kDisableWebRtcEncryption, | 2756 switches::kDisableWebRtcEncryption, |
2758 }; | 2757 }; |
2759 to_command_line->CopySwitchesFrom(from_command_line, | 2758 to_command_line->CopySwitchesFrom(from_command_line, |
2760 kWebRtcDevSwitchNames, | 2759 kWebRtcDevSwitchNames, |
2761 arraysize(kWebRtcDevSwitchNames)); | 2760 arraysize(kWebRtcDevSwitchNames)); |
2762 } | 2761 } |
2763 } | 2762 } |
2764 #endif // defined(ENABLE_WEBRTC) | 2763 #endif // defined(ENABLE_WEBRTC) |
2765 | 2764 |
2766 } // namespace chrome | 2765 } // namespace chrome |
OLD | NEW |