Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(303)

Side by Side Diff: extensions/browser/api/web_request/web_request_api_helpers.cc

Issue 566823003: Move declarative_webrequest: action, rules_registry (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fixing another weird re-base error. Created 6 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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_helpers.h" 5 #include "extensions/browser/api/web_request/web_request_api_helpers.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/strings/string_number_conversions.h" 10 #include "base/strings/string_number_conversions.h"
11 #include "base/strings/string_util.h" 11 #include "base/strings/string_util.h"
12 #include "base/strings/stringprintf.h" 12 #include "base/strings/stringprintf.h"
13 #include "base/time/time.h" 13 #include "base/time/time.h"
14 #include "base/values.h" 14 #include "base/values.h"
15 #include "chrome/browser/extensions/api/web_request/web_request_api.h"
16 #include "components/web_cache/browser/web_cache_manager.h" 15 #include "components/web_cache/browser/web_cache_manager.h"
17 #include "content/public/browser/browser_thread.h" 16 #include "content/public/browser/browser_thread.h"
18 #include "content/public/browser/render_process_host.h" 17 #include "content/public/browser/render_process_host.h"
18 #include "extensions/browser/extension_registry.h"
19 #include "extensions/browser/extension_system.h" 19 #include "extensions/browser/extension_system.h"
20 #include "extensions/browser/extensions_browser_client.h"
20 #include "extensions/browser/runtime_data.h" 21 #include "extensions/browser/runtime_data.h"
21 #include "extensions/browser/warning_set.h" 22 #include "extensions/browser/warning_set.h"
23 #include "extensions/common/extension_messages.h"
22 #include "net/base/net_log.h" 24 #include "net/base/net_log.h"
23 #include "net/cookies/cookie_util.h" 25 #include "net/cookies/cookie_util.h"
24 #include "net/cookies/parsed_cookie.h" 26 #include "net/cookies/parsed_cookie.h"
25 #include "net/http/http_util.h" 27 #include "net/http/http_util.h"
26 #include "net/url_request/url_request.h" 28 #include "net/url_request/url_request.h"
27 #include "url/url_constants.h" 29 #include "url/url_constants.h"
28 30
29 // TODO(battre): move all static functions into an anonymous namespace at the 31 // TODO(battre): move all static functions into an anonymous namespace at the
30 // top of this file. 32 // top of this file.
31 33
(...skipping 1139 matching lines...) Expand 10 before | Expand all | Expand 10 after
1171 1173
1172 for (content::RenderProcessHost::iterator it = 1174 for (content::RenderProcessHost::iterator it =
1173 content::RenderProcessHost::AllHostsIterator(); 1175 content::RenderProcessHost::AllHostsIterator();
1174 !it.IsAtEnd(); it.Advance()) { 1176 !it.IsAtEnd(); it.Advance()) {
1175 content::RenderProcessHost* host = it.GetCurrentValue(); 1177 content::RenderProcessHost* host = it.GetCurrentValue();
1176 if (host->GetBrowserContext() == browser_context) 1178 if (host->GetBrowserContext() == browser_context)
1177 SendExtensionWebRequestStatusToHost(host); 1179 SendExtensionWebRequestStatusToHost(host);
1178 } 1180 }
1179 } 1181 }
1180 1182
1183 void SendExtensionWebRequestStatusToHost(content::RenderProcessHost* host) {
1184 content::BrowserContext* browser_context = host->GetBrowserContext();
1185 if (!browser_context)
1186 return;
1187
1188 bool webrequest_used = false;
1189 const extensions::ExtensionSet& extensions =
1190 extensions::ExtensionRegistry::Get(browser_context)->enabled_extensions();
1191 extensions::RuntimeData* runtime_data =
1192 extensions::ExtensionSystem::Get(browser_context)->runtime_data();
1193 for (extensions::ExtensionSet::const_iterator it = extensions.begin();
1194 !webrequest_used && it != extensions.end();
1195 ++it) {
1196 webrequest_used |= runtime_data->HasUsedWebRequest(it->get());
1197 }
1198
1199 host->Send(new ExtensionMsg_UsingWebRequestAPI(webrequest_used));
1200 }
1201
1181 } // namespace extension_web_request_api_helpers 1202 } // namespace extension_web_request_api_helpers
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698