| 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 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 46 #include "content/public/browser/browser_message_filter.h" | 46 #include "content/public/browser/browser_message_filter.h" |
| 47 #include "content/public/browser/browser_thread.h" | 47 #include "content/public/browser/browser_thread.h" |
| 48 #include "content/public/browser/render_process_host.h" | 48 #include "content/public/browser/render_process_host.h" |
| 49 #include "content/public/browser/resource_request_info.h" | 49 #include "content/public/browser/resource_request_info.h" |
| 50 #include "content/public/browser/user_metrics.h" | 50 #include "content/public/browser/user_metrics.h" |
| 51 #include "extensions/browser/event_router.h" | 51 #include "extensions/browser/event_router.h" |
| 52 #include "extensions/browser/info_map.h" | 52 #include "extensions/browser/info_map.h" |
| 53 #include "extensions/common/error_utils.h" | 53 #include "extensions/common/error_utils.h" |
| 54 #include "extensions/common/event_filtering_info.h" | 54 #include "extensions/common/event_filtering_info.h" |
| 55 #include "extensions/common/extension.h" | 55 #include "extensions/common/extension.h" |
| 56 #include "extensions/common/extension_set.h" |
| 56 #include "extensions/common/features/feature.h" | 57 #include "extensions/common/features/feature.h" |
| 57 #include "extensions/common/permissions/permissions_data.h" | 58 #include "extensions/common/permissions/permissions_data.h" |
| 58 #include "extensions/common/url_pattern.h" | 59 #include "extensions/common/url_pattern.h" |
| 59 #include "grit/generated_resources.h" | 60 #include "grit/generated_resources.h" |
| 60 #include "net/base/auth.h" | 61 #include "net/base/auth.h" |
| 61 #include "net/base/net_errors.h" | 62 #include "net/base/net_errors.h" |
| 62 #include "net/base/upload_data_stream.h" | 63 #include "net/base/upload_data_stream.h" |
| 63 #include "net/http/http_response_headers.h" | 64 #include "net/http/http_response_headers.h" |
| 64 #include "net/url_request/url_request.h" | 65 #include "net/url_request/url_request.h" |
| 65 #include "ui/base/l10n/l10n_util.h" | 66 #include "ui/base/l10n/l10n_util.h" |
| (...skipping 2288 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2354 } | 2355 } |
| 2355 | 2356 |
| 2356 void SendExtensionWebRequestStatusToHost(content::RenderProcessHost* host) { | 2357 void SendExtensionWebRequestStatusToHost(content::RenderProcessHost* host) { |
| 2357 Profile* profile = Profile::FromBrowserContext(host->GetBrowserContext()); | 2358 Profile* profile = Profile::FromBrowserContext(host->GetBrowserContext()); |
| 2358 if (!profile || !profile->GetExtensionService()) | 2359 if (!profile || !profile->GetExtensionService()) |
| 2359 return; | 2360 return; |
| 2360 | 2361 |
| 2361 bool adblock = false; | 2362 bool adblock = false; |
| 2362 bool adblock_plus = false; | 2363 bool adblock_plus = false; |
| 2363 bool other = false; | 2364 bool other = false; |
| 2364 const ExtensionSet* extensions = | 2365 const extensions::ExtensionSet* extensions = |
| 2365 profile->GetExtensionService()->extensions(); | 2366 profile->GetExtensionService()->extensions(); |
| 2366 for (ExtensionSet::const_iterator it = extensions->begin(); | 2367 for (extensions::ExtensionSet::const_iterator it = extensions->begin(); |
| 2367 it != extensions->end(); ++it) { | 2368 it != extensions->end(); ++it) { |
| 2368 if (profile->GetExtensionService()->HasUsedWebRequest(it->get())) { | 2369 if (profile->GetExtensionService()->HasUsedWebRequest(it->get())) { |
| 2369 if ((*it)->name().find("Adblock Plus") != std::string::npos) { | 2370 if ((*it)->name().find("Adblock Plus") != std::string::npos) { |
| 2370 adblock_plus = true; | 2371 adblock_plus = true; |
| 2371 } else if ((*it)->name().find("AdBlock") != std::string::npos) { | 2372 } else if ((*it)->name().find("AdBlock") != std::string::npos) { |
| 2372 adblock = true; | 2373 adblock = true; |
| 2373 } else { | 2374 } else { |
| 2374 other = true; | 2375 other = true; |
| 2375 } | 2376 } |
| 2376 } | 2377 } |
| 2377 } | 2378 } |
| 2378 | 2379 |
| 2379 host->Send(new ExtensionMsg_UsingWebRequestAPI(adblock, adblock_plus, other)); | 2380 host->Send(new ExtensionMsg_UsingWebRequestAPI(adblock, adblock_plus, other)); |
| 2380 } | 2381 } |
| OLD | NEW |