| 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/json/json_writer.h" | 10 #include "base/json/json_writer.h" |
| (...skipping 1355 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1366 } | 1366 } |
| 1367 | 1367 |
| 1368 bool ExtensionWebRequestEventRouter::ProcessDeclarativeRules( | 1368 bool ExtensionWebRequestEventRouter::ProcessDeclarativeRules( |
| 1369 net::URLRequest* request, | 1369 net::URLRequest* request, |
| 1370 extensions::RequestStages request_stage) { | 1370 extensions::RequestStages request_stage) { |
| 1371 if (!rules_registry_.get()) | 1371 if (!rules_registry_.get()) |
| 1372 return false; | 1372 return false; |
| 1373 | 1373 |
| 1374 base::Time start = base::Time::Now(); | 1374 base::Time start = base::Time::Now(); |
| 1375 | 1375 |
| 1376 // TODO(battre): Annotate deltas with extension IDs, so that we can |
| 1377 // - Sort deltas by precedence |
| 1378 // - Check whether extensions have host permissions. |
| 1376 std::list<linked_ptr<helpers::EventResponseDelta> > result = | 1379 std::list<linked_ptr<helpers::EventResponseDelta> > result = |
| 1377 rules_registry_->CreateDeltas(request, request_stage); | 1380 rules_registry_->CreateDeltas(request, request_stage); |
| 1378 | 1381 |
| 1379 base::TimeDelta elapsed_time = start - base::Time::Now(); | 1382 base::TimeDelta elapsed_time = start - base::Time::Now(); |
| 1380 UMA_HISTOGRAM_TIMES("Extensions.DeclarativeWebRequestNetworkDelay", | 1383 UMA_HISTOGRAM_TIMES("Extensions.DeclarativeWebRequestNetworkDelay", |
| 1381 elapsed_time); | 1384 elapsed_time); |
| 1382 | 1385 |
| 1383 if (result.empty()) | 1386 if (result.empty()) |
| 1384 return false; | 1387 return false; |
| 1385 | 1388 |
| (...skipping 322 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1708 } else if ((*it)->name().find("AdBlock") != std::string::npos) { | 1711 } else if ((*it)->name().find("AdBlock") != std::string::npos) { |
| 1709 adblock = true; | 1712 adblock = true; |
| 1710 } else { | 1713 } else { |
| 1711 other = true; | 1714 other = true; |
| 1712 } | 1715 } |
| 1713 } | 1716 } |
| 1714 } | 1717 } |
| 1715 | 1718 |
| 1716 host->Send(new ExtensionMsg_UsingWebRequestAPI(adblock, adblock_plus, other)); | 1719 host->Send(new ExtensionMsg_UsingWebRequestAPI(adblock, adblock_plus, other)); |
| 1717 } | 1720 } |
| OLD | NEW |