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 by policy (URL || Origin). | |
1504 if (extension_info_map) { | |
1505 const extensions::Extension* extension = | |
1506 extension_info_map->extensions().GetByID(listener->id.extension_id); | |
1507 if (extension->permissions_data()->IsRuntimeBlockedHost(url)) | |
Devlin
2017/05/15 20:54:51
Why do we need this? WebRequestPermissions::CanEx
nrpeter
2017/05/15 22:44:43
IIUC, if you want to redirect a web request, the e
| |
1508 access = PermissionsData::ACCESS_WITHHELD; | |
Devlin
2017/05/15 20:54:51
We would want DENIED, right? WITHHELD will surfac
nrpeter
2017/05/15 22:44:43
Done.
| |
1509 else if (extension->permissions_data()->IsRuntimeBlockedHost( | |
1510 request->first_party_for_cookies())) | |
1511 access = PermissionsData::ACCESS_WITHHELD; | |
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 |