| 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/extensions/api/web_request/web_request_api.h" | 5 #include "chrome/browser/extensions/api/web_request/web_request_api.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
| (...skipping 1267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1278 if (it->filter.tab_id != -1 && tab_id != it->filter.tab_id) | 1278 if (it->filter.tab_id != -1 && tab_id != it->filter.tab_id) |
| 1279 continue; | 1279 continue; |
| 1280 if (it->filter.window_id != -1 && window_id != it->filter.window_id) | 1280 if (it->filter.window_id != -1 && window_id != it->filter.window_id) |
| 1281 continue; | 1281 continue; |
| 1282 if (!it->filter.types.empty() && | 1282 if (!it->filter.types.empty() && |
| 1283 std::find(it->filter.types.begin(), it->filter.types.end(), | 1283 std::find(it->filter.types.begin(), it->filter.types.end(), |
| 1284 resource_type) == it->filter.types.end()) | 1284 resource_type) == it->filter.types.end()) |
| 1285 continue; | 1285 continue; |
| 1286 | 1286 |
| 1287 if (!WebRequestPermissions::CanExtensionAccessURL( | 1287 if (!WebRequestPermissions::CanExtensionAccessURL( |
| 1288 extension_info_map, it->extension_id, url, crosses_incognito, true)) | 1288 extension_info_map, it->extension_id, url, crosses_incognito, |
| 1289 WebRequestPermissions::REQUIRE_HOST_PERMISSION)) |
| 1289 continue; | 1290 continue; |
| 1290 | 1291 |
| 1291 bool blocking_listener = | 1292 bool blocking_listener = |
| 1292 (it->extra_info_spec & | 1293 (it->extra_info_spec & |
| 1293 (ExtraInfoSpec::BLOCKING | ExtraInfoSpec::ASYNC_BLOCKING)) != 0; | 1294 (ExtraInfoSpec::BLOCKING | ExtraInfoSpec::ASYNC_BLOCKING)) != 0; |
| 1294 | 1295 |
| 1295 // We do not want to notify extensions about XHR requests that are | 1296 // We do not want to notify extensions about XHR requests that are |
| 1296 // triggered by themselves. This is a workaround to prevent deadlocks | 1297 // triggered by themselves. This is a workaround to prevent deadlocks |
| 1297 // in case of synchronous XHR requests that block the extension renderer | 1298 // in case of synchronous XHR requests that block the extension renderer |
| 1298 // and therefore prevent the extension from processing the request | 1299 // and therefore prevent the extension from processing the request |
| (...skipping 715 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2014 } else if ((*it)->name().find("AdBlock") != std::string::npos) { | 2015 } else if ((*it)->name().find("AdBlock") != std::string::npos) { |
| 2015 adblock = true; | 2016 adblock = true; |
| 2016 } else { | 2017 } else { |
| 2017 other = true; | 2018 other = true; |
| 2018 } | 2019 } |
| 2019 } | 2020 } |
| 2020 } | 2021 } |
| 2021 | 2022 |
| 2022 host->Send(new ExtensionMsg_UsingWebRequestAPI(adblock, adblock_plus, other)); | 2023 host->Send(new ExtensionMsg_UsingWebRequestAPI(adblock, adblock_plus, other)); |
| 2023 } | 2024 } |
| OLD | NEW |