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 1679 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1690 } | 1690 } |
1691 | 1691 |
1692 void SendExtensionWebRequestStatusToHost(content::RenderProcessHost* host) { | 1692 void SendExtensionWebRequestStatusToHost(content::RenderProcessHost* host) { |
1693 Profile* profile = Profile::FromBrowserContext(host->GetBrowserContext()); | 1693 Profile* profile = Profile::FromBrowserContext(host->GetBrowserContext()); |
1694 if (!profile || !profile->GetExtensionService()) | 1694 if (!profile || !profile->GetExtensionService()) |
1695 return; | 1695 return; |
1696 | 1696 |
1697 bool adblock = false; | 1697 bool adblock = false; |
1698 bool adblock_plus = false; | 1698 bool adblock_plus = false; |
1699 bool other = false; | 1699 bool other = false; |
1700 const ExtensionList* extensions = | 1700 const ExtensionSet* extensions = |
1701 profile->GetExtensionService()->extensions(); | 1701 profile->GetExtensionService()->extensions(); |
1702 for (ExtensionList::const_iterator it = extensions->begin(); | 1702 for (ExtensionSet::const_iterator it = extensions->begin(); |
1703 it != extensions->end(); ++it) { | 1703 it != extensions->end(); ++it) { |
1704 if (profile->GetExtensionService()->HasUsedWebRequest(*it)) { | 1704 if (profile->GetExtensionService()->HasUsedWebRequest(*it)) { |
1705 if ((*it)->name().find("Adblock Plus") != std::string::npos) { | 1705 if ((*it)->name().find("Adblock Plus") != std::string::npos) { |
1706 adblock_plus = true; | 1706 adblock_plus = true; |
1707 } else if ((*it)->name().find("AdBlock") != std::string::npos) { | 1707 } else if ((*it)->name().find("AdBlock") != std::string::npos) { |
1708 adblock = true; | 1708 adblock = true; |
1709 } else { | 1709 } else { |
1710 other = true; | 1710 other = true; |
1711 } | 1711 } |
1712 } | 1712 } |
1713 } | 1713 } |
1714 | 1714 |
1715 host->Send(new ExtensionMsg_UsingWebRequestAPI(adblock, adblock_plus, other)); | 1715 host->Send(new ExtensionMsg_UsingWebRequestAPI(adblock, adblock_plus, other)); |
1716 } | 1716 } |
OLD | NEW |