Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(57)

Side by Side Diff: chrome/browser/chrome_content_browser_client.cc

Issue 309533007: Refactor PermissionsData pt1 (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 2488 matching lines...) Expand 10 before | Expand all | Expand 10 after
2499 if (IsExtensionOrSharedModuleWhitelisted(url, extension_set, 2499 if (IsExtensionOrSharedModuleWhitelisted(url, extension_set,
2500 allowed_socket_origins_)) { 2500 allowed_socket_origins_)) {
2501 return true; 2501 return true;
2502 } 2502 }
2503 } else { 2503 } else {
2504 // Access to public socket APIs is controlled by extension permissions. 2504 // Access to public socket APIs is controlled by extension permissions.
2505 if (url.is_valid() && url.SchemeIs(extensions::kExtensionScheme) && 2505 if (url.is_valid() && url.SchemeIs(extensions::kExtensionScheme) &&
2506 extension_set) { 2506 extension_set) {
2507 const Extension* extension = extension_set->GetByID(url.host()); 2507 const Extension* extension = extension_set->GetByID(url.host());
2508 if (extension) { 2508 if (extension) {
2509 const extensions::PermissionsData* permissions_data =
2510 extensions::PermissionsData::ForExtension(extension);
2509 if (params) { 2511 if (params) {
2510 extensions::SocketPermission::CheckParam check_params( 2512 extensions::SocketPermission::CheckParam check_params(
2511 params->type, params->host, params->port); 2513 params->type, params->host, params->port);
2512 if (extensions::PermissionsData::CheckAPIPermissionWithParam( 2514 if (permissions_data->CheckAPIPermissionWithParam(
2513 extension, extensions::APIPermission::kSocket, 2515 extensions::APIPermission::kSocket, &check_params)) {
2514 &check_params)) {
2515 return true; 2516 return true;
2516 } 2517 }
2517 } else { 2518 } else if (permissions_data->HasAPIPermission(
2518 if (extensions::PermissionsData::HasAPIPermission( 2519 extensions::APIPermission::kSocket)) {
2519 extension, extensions::APIPermission::kSocket)) { 2520 return true;
2520 return true;
2521 }
2522 } 2521 }
2523 } 2522 }
2524 } 2523 }
2525 } 2524 }
2526 2525
2527 // Allow both public and private APIs if the command line says so. 2526 // Allow both public and private APIs if the command line says so.
2528 return IsHostAllowedByCommandLine(url, extension_set, 2527 return IsHostAllowedByCommandLine(url, extension_set,
2529 switches::kAllowNaClSocketAPI); 2528 switches::kAllowNaClSocketAPI);
2530 #else 2529 #else
2531 return false; 2530 return false;
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after
2756 switches::kDisableWebRtcEncryption, 2755 switches::kDisableWebRtcEncryption,
2757 }; 2756 };
2758 to_command_line->CopySwitchesFrom(from_command_line, 2757 to_command_line->CopySwitchesFrom(from_command_line,
2759 kWebRtcDevSwitchNames, 2758 kWebRtcDevSwitchNames,
2760 arraysize(kWebRtcDevSwitchNames)); 2759 arraysize(kWebRtcDevSwitchNames));
2761 } 2760 }
2762 } 2761 }
2763 #endif // defined(ENABLE_WEBRTC) 2762 #endif // defined(ENABLE_WEBRTC)
2764 2763
2765 } // namespace chrome 2764 } // namespace chrome
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698