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_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/string_util.h" | 10 #include "base/string_util.h" |
(...skipping 1245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1256 } | 1256 } |
1257 | 1257 |
1258 void NotifyWebRequestAPIUsed( | 1258 void NotifyWebRequestAPIUsed( |
1259 void* profile_id, | 1259 void* profile_id, |
1260 scoped_refptr<const extensions::Extension> extension) { | 1260 scoped_refptr<const extensions::Extension> extension) { |
1261 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); | 1261 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); |
1262 Profile* profile = reinterpret_cast<Profile*>(profile_id); | 1262 Profile* profile = reinterpret_cast<Profile*>(profile_id); |
1263 if (!g_browser_process->profile_manager()->IsValidProfile(profile)) | 1263 if (!g_browser_process->profile_manager()->IsValidProfile(profile)) |
1264 return; | 1264 return; |
1265 | 1265 |
1266 if (profile->GetExtensionService()->HasUsedWebRequest(extension)) | 1266 if (profile->GetExtensionService()->HasUsedWebRequest(extension.get())) |
1267 return; | 1267 return; |
1268 profile->GetExtensionService()->SetHasUsedWebRequest(extension, true); | 1268 profile->GetExtensionService()->SetHasUsedWebRequest(extension.get(), true); |
1269 | 1269 |
1270 content::BrowserContext* browser_context = profile; | 1270 content::BrowserContext* browser_context = profile; |
1271 for (content::RenderProcessHost::iterator it = | 1271 for (content::RenderProcessHost::iterator it = |
1272 content::RenderProcessHost::AllHostsIterator(); | 1272 content::RenderProcessHost::AllHostsIterator(); |
1273 !it.IsAtEnd(); it.Advance()) { | 1273 !it.IsAtEnd(); it.Advance()) { |
1274 content::RenderProcessHost* host = it.GetCurrentValue(); | 1274 content::RenderProcessHost* host = it.GetCurrentValue(); |
1275 if (host->GetBrowserContext() == browser_context) | 1275 if (host->GetBrowserContext() == browser_context) |
1276 SendExtensionWebRequestStatusToHost(host); | 1276 SendExtensionWebRequestStatusToHost(host); |
1277 } | 1277 } |
1278 } | 1278 } |
1279 | 1279 |
1280 } // namespace extension_web_request_api_helpers | 1280 } // namespace extension_web_request_api_helpers |
OLD | NEW |