| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/extension_webrequest_api.h" | 5 #include "chrome/browser/extensions/extension_webrequest_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 1634 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1645 } | 1645 } |
| 1646 | 1646 |
| 1647 void SendExtensionWebRequestStatusToHost(content::RenderProcessHost* host) { | 1647 void SendExtensionWebRequestStatusToHost(content::RenderProcessHost* host) { |
| 1648 Profile* profile = Profile::FromBrowserContext(host->GetBrowserContext()); | 1648 Profile* profile = Profile::FromBrowserContext(host->GetBrowserContext()); |
| 1649 if (!profile || !profile->GetExtensionService()) | 1649 if (!profile || !profile->GetExtensionService()) |
| 1650 return; | 1650 return; |
| 1651 | 1651 |
| 1652 bool adblock = false; | 1652 bool adblock = false; |
| 1653 bool adblock_plus = false; | 1653 bool adblock_plus = false; |
| 1654 bool other = false; | 1654 bool other = false; |
| 1655 const ExtensionList* extensions = | 1655 const ExtensionSet* extensions = |
| 1656 profile->GetExtensionService()->extensions(); | 1656 profile->GetExtensionService()->extensions(); |
| 1657 for (ExtensionList::const_iterator it = extensions->begin(); | 1657 for (ExtensionSet::const_iterator it = extensions->begin(); |
| 1658 it != extensions->end(); ++it) { | 1658 it != extensions->end(); ++it) { |
| 1659 if (profile->GetExtensionService()->HasUsedWebRequest(*it)) { | 1659 if (profile->GetExtensionService()->HasUsedWebRequest(*it)) { |
| 1660 if ((*it)->name().find("Adblock Plus") != std::string::npos) { | 1660 if ((*it)->name().find("Adblock Plus") != std::string::npos) { |
| 1661 adblock_plus = true; | 1661 adblock_plus = true; |
| 1662 } else if ((*it)->name().find("AdBlock") != std::string::npos) { | 1662 } else if ((*it)->name().find("AdBlock") != std::string::npos) { |
| 1663 adblock = true; | 1663 adblock = true; |
| 1664 } else { | 1664 } else { |
| 1665 other = true; | 1665 other = true; |
| 1666 } | 1666 } |
| 1667 } | 1667 } |
| 1668 } | 1668 } |
| 1669 | 1669 |
| 1670 host->Send(new ExtensionMsg_UsingWebRequestAPI(adblock, adblock_plus, other)); | 1670 host->Send(new ExtensionMsg_UsingWebRequestAPI(adblock, adblock_plus, other)); |
| 1671 } | 1671 } |
| OLD | NEW |