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

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

Issue 131743021: app_shell: Extract extension runtime data from ExtensionService (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: TriggerOnUnloaded (runtime_data) Created 6 years, 11 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 | Annotate | Revision Log
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 "chrome/browser/extensions/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/browser_process.h" 15 #include "chrome/browser/browser_process.h"
16 #include "chrome/browser/extensions/api/web_request/web_request_api.h" 16 #include "chrome/browser/extensions/api/web_request/web_request_api.h"
17 #include "chrome/browser/extensions/extension_service.h"
18 #include "chrome/browser/extensions/extension_warning_set.h" 17 #include "chrome/browser/extensions/extension_warning_set.h"
19 #include "chrome/browser/profiles/profile_manager.h" 18 #include "chrome/browser/profiles/profile_manager.h"
20 #include "chrome/browser/renderer_host/web_cache_manager.h" 19 #include "chrome/browser/renderer_host/web_cache_manager.h"
21 #include "chrome/common/url_constants.h" 20 #include "chrome/common/url_constants.h"
22 #include "content/public/browser/browser_thread.h" 21 #include "content/public/browser/browser_thread.h"
23 #include "content/public/browser/render_process_host.h" 22 #include "content/public/browser/render_process_host.h"
23 #include "extensions/browser/runtime_data.h"
24 #include "net/base/net_log.h" 24 #include "net/base/net_log.h"
25 #include "net/cookies/cookie_util.h" 25 #include "net/cookies/cookie_util.h"
26 #include "net/cookies/parsed_cookie.h" 26 #include "net/cookies/parsed_cookie.h"
27 #include "net/http/http_util.h" 27 #include "net/http/http_util.h"
28 #include "net/url_request/url_request.h" 28 #include "net/url_request/url_request.h"
29 29
30 // TODO(battre): move all static functions into an anonymous namespace at the 30 // TODO(battre): move all static functions into an anonymous namespace at the
31 // top of this file. 31 // top of this file.
32 32
33 using base::Time; 33 using base::Time;
(...skipping 1223 matching lines...) Expand 10 before | Expand all | Expand 10 after
1257 } 1257 }
1258 1258
1259 void NotifyWebRequestAPIUsed( 1259 void NotifyWebRequestAPIUsed(
1260 void* profile_id, 1260 void* profile_id,
1261 scoped_refptr<const extensions::Extension> extension) { 1261 scoped_refptr<const extensions::Extension> extension) {
1262 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); 1262 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI));
1263 Profile* profile = reinterpret_cast<Profile*>(profile_id); 1263 Profile* profile = reinterpret_cast<Profile*>(profile_id);
1264 if (!g_browser_process->profile_manager()->IsValidProfile(profile)) 1264 if (!g_browser_process->profile_manager()->IsValidProfile(profile))
1265 return; 1265 return;
1266 1266
1267 if (profile->GetExtensionService()->HasUsedWebRequest(extension.get())) 1267 extensions::RuntimeData* runtime_data =
1268 extensions::ExtensionSystem::Get(profile)->runtime_data();
1269 if (runtime_data->HasUsedWebRequest(extension.get()))
1268 return; 1270 return;
1269 profile->GetExtensionService()->SetHasUsedWebRequest(extension.get(), true); 1271 runtime_data->SetHasUsedWebRequest(extension.get(), true);
1270 1272
1271 content::BrowserContext* browser_context = profile; 1273 content::BrowserContext* browser_context = profile;
1272 for (content::RenderProcessHost::iterator it = 1274 for (content::RenderProcessHost::iterator it =
1273 content::RenderProcessHost::AllHostsIterator(); 1275 content::RenderProcessHost::AllHostsIterator();
1274 !it.IsAtEnd(); it.Advance()) { 1276 !it.IsAtEnd(); it.Advance()) {
1275 content::RenderProcessHost* host = it.GetCurrentValue(); 1277 content::RenderProcessHost* host = it.GetCurrentValue();
1276 if (host->GetBrowserContext() == browser_context) 1278 if (host->GetBrowserContext() == browser_context)
1277 SendExtensionWebRequestStatusToHost(host); 1279 SendExtensionWebRequestStatusToHost(host);
1278 } 1280 }
1279 } 1281 }
1280 1282
1281 } // namespace extension_web_request_api_helpers 1283 } // namespace extension_web_request_api_helpers
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698