| 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 2343 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2354 } | 2354 } |
| 2355 | 2355 |
| 2356 void SendExtensionWebRequestStatusToHost(content::RenderProcessHost* host) { | 2356 void SendExtensionWebRequestStatusToHost(content::RenderProcessHost* host) { |
| 2357 Profile* profile = Profile::FromBrowserContext(host->GetBrowserContext()); | 2357 Profile* profile = Profile::FromBrowserContext(host->GetBrowserContext()); |
| 2358 if (!profile || !profile->GetExtensionService()) | 2358 if (!profile || !profile->GetExtensionService()) |
| 2359 return; | 2359 return; |
| 2360 | 2360 |
| 2361 bool adblock = false; | 2361 bool adblock = false; |
| 2362 bool adblock_plus = false; | 2362 bool adblock_plus = false; |
| 2363 bool other = false; | 2363 bool other = false; |
| 2364 const ExtensionSet* extensions = | 2364 const extensions::ExtensionSet* extensions = |
| 2365 profile->GetExtensionService()->extensions(); | 2365 profile->GetExtensionService()->extensions(); |
| 2366 for (ExtensionSet::const_iterator it = extensions->begin(); | 2366 for (extensions::ExtensionSet::const_iterator it = extensions->begin(); |
| 2367 it != extensions->end(); ++it) { | 2367 it != extensions->end(); ++it) { |
| 2368 if (profile->GetExtensionService()->HasUsedWebRequest(it->get())) { | 2368 if (profile->GetExtensionService()->HasUsedWebRequest(it->get())) { |
| 2369 if ((*it)->name().find("Adblock Plus") != std::string::npos) { | 2369 if ((*it)->name().find("Adblock Plus") != std::string::npos) { |
| 2370 adblock_plus = true; | 2370 adblock_plus = true; |
| 2371 } else if ((*it)->name().find("AdBlock") != std::string::npos) { | 2371 } else if ((*it)->name().find("AdBlock") != std::string::npos) { |
| 2372 adblock = true; | 2372 adblock = true; |
| 2373 } else { | 2373 } else { |
| 2374 other = true; | 2374 other = true; |
| 2375 } | 2375 } |
| 2376 } | 2376 } |
| 2377 } | 2377 } |
| 2378 | 2378 |
| 2379 host->Send(new ExtensionMsg_UsingWebRequestAPI(adblock, adblock_plus, other)); | 2379 host->Send(new ExtensionMsg_UsingWebRequestAPI(adblock, adblock_plus, other)); |
| 2380 } | 2380 } |
| OLD | NEW |