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 "extensions/browser/api/web_request/web_request_api.h" | 5 #include "extensions/browser/api/web_request/web_request_api.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <algorithm> | 9 #include <algorithm> |
10 #include <memory> | 10 #include <memory> |
(...skipping 1481 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1492 std::find(types.begin(), types.end(), resource_type) == types.end()) { | 1492 std::find(types.begin(), types.end(), resource_type) == types.end()) { |
1493 continue; | 1493 continue; |
1494 } | 1494 } |
1495 | 1495 |
1496 if (!is_web_view_guest) { | 1496 if (!is_web_view_guest) { |
1497 PermissionsData::AccessType access = | 1497 PermissionsData::AccessType access = |
1498 WebRequestPermissions::CanExtensionAccessURL( | 1498 WebRequestPermissions::CanExtensionAccessURL( |
1499 extension_info_map, listener->id.extension_id, url, | 1499 extension_info_map, listener->id.extension_id, url, |
1500 frame_data.tab_id, crosses_incognito, | 1500 frame_data.tab_id, crosses_incognito, |
1501 WebRequestPermissions::REQUIRE_HOST_PERMISSION); | 1501 WebRequestPermissions::REQUIRE_HOST_PERMISSION); |
| 1502 |
| 1503 // Check if URL blocked from view/modification due to a policy protected |
| 1504 // origin. |
| 1505 if (extension_info_map) { |
| 1506 const extensions::Extension* extension = |
| 1507 extension_info_map->extensions().GetByID(listener->id.extension_id); |
| 1508 if (request->initiator() && |
| 1509 extension->permissions_data()->IsRuntimeBlockedHost( |
| 1510 request->initiator()->GetPhysicalOrigin().GetURL())) |
| 1511 access = PermissionsData::ACCESS_DENIED; |
| 1512 } |
| 1513 |
1502 if (access != PermissionsData::ACCESS_ALLOWED) { | 1514 if (access != PermissionsData::ACCESS_ALLOWED) { |
1503 if (access == PermissionsData::ACCESS_WITHHELD && | 1515 if (access == PermissionsData::ACCESS_WITHHELD && |
1504 web_request_event_router_delegate_) { | 1516 web_request_event_router_delegate_) { |
1505 web_request_event_router_delegate_->NotifyWebRequestWithheld( | 1517 web_request_event_router_delegate_->NotifyWebRequestWithheld( |
1506 render_process_id, render_frame_id, listener->id.extension_id); | 1518 render_process_id, render_frame_id, listener->id.extension_id); |
1507 } | 1519 } |
1508 continue; | 1520 continue; |
1509 } | 1521 } |
1510 } | 1522 } |
1511 | 1523 |
(...skipping 932 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2444 // Since EventListeners are segmented by browser_context, check that | 2456 // Since EventListeners are segmented by browser_context, check that |
2445 // last, as it is exceedingly unlikely to be different. | 2457 // last, as it is exceedingly unlikely to be different. |
2446 return extension_id == that.extension_id && | 2458 return extension_id == that.extension_id && |
2447 sub_event_name == that.sub_event_name && | 2459 sub_event_name == that.sub_event_name && |
2448 web_view_instance_id == that.web_view_instance_id && | 2460 web_view_instance_id == that.web_view_instance_id && |
2449 embedder_process_id == that.embedder_process_id && | 2461 embedder_process_id == that.embedder_process_id && |
2450 browser_context == that.browser_context; | 2462 browser_context == that.browser_context; |
2451 } | 2463 } |
2452 | 2464 |
2453 } // namespace extensions | 2465 } // namespace extensions |
OLD | NEW |