Chromium Code Reviews| 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 "extensions/browser/api/web_request/web_request_api_helpers.h" | 5 #include "extensions/browser/api/web_request/web_request_api_helpers.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <cmath> | 8 #include <cmath> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 1188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1199 scoped_refptr<const extensions::Extension> extension) { | 1199 scoped_refptr<const extensions::Extension> extension) { |
| 1200 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); | 1200 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
| 1201 content::BrowserContext* browser_context = | 1201 content::BrowserContext* browser_context = |
| 1202 reinterpret_cast<content::BrowserContext*>(browser_context_id); | 1202 reinterpret_cast<content::BrowserContext*>(browser_context_id); |
| 1203 if (!extensions::ExtensionsBrowserClient::Get()->IsValidContext( | 1203 if (!extensions::ExtensionsBrowserClient::Get()->IsValidContext( |
| 1204 browser_context)) | 1204 browser_context)) |
| 1205 return; | 1205 return; |
| 1206 | 1206 |
| 1207 extensions::RuntimeData* runtime_data = | 1207 extensions::RuntimeData* runtime_data = |
| 1208 extensions::ExtensionSystem::Get(browser_context)->runtime_data(); | 1208 extensions::ExtensionSystem::Get(browser_context)->runtime_data(); |
| 1209 if (runtime_data->HasUsedWebRequest(extension.get())) | 1209 if (extension) { |
| 1210 return; | 1210 if (runtime_data->HasUsedWebRequest(extension.get())) |
| 1211 runtime_data->SetHasUsedWebRequest(extension.get(), true); | 1211 return; |
| 1212 runtime_data->SetHasUsedWebRequest(extension.get(), true); | |
|
Fady Samuel
2014/10/21 21:32:57
What's going on here? I'm confused.
guohui
2014/10/22 15:35:33
lets continue discussion in the other cl https://c
| |
| 1213 } | |
| 1212 | 1214 |
| 1213 for (content::RenderProcessHost::iterator it = | 1215 for (content::RenderProcessHost::iterator it = |
| 1214 content::RenderProcessHost::AllHostsIterator(); | 1216 content::RenderProcessHost::AllHostsIterator(); |
| 1215 !it.IsAtEnd(); it.Advance()) { | 1217 !it.IsAtEnd(); it.Advance()) { |
| 1216 content::RenderProcessHost* host = it.GetCurrentValue(); | 1218 content::RenderProcessHost* host = it.GetCurrentValue(); |
| 1217 if (host->GetBrowserContext() == browser_context) | 1219 if (host->GetBrowserContext() == browser_context) |
| 1218 SendExtensionWebRequestStatusToHost(host); | 1220 SendExtensionWebRequestStatusToHost(host); |
| 1219 } | 1221 } |
| 1220 } | 1222 } |
| 1221 | 1223 |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1280 std::find(kResourceTypeStrings, | 1282 std::find(kResourceTypeStrings, |
| 1281 kResourceTypeStrings + kResourceTypeStringsLength, | 1283 kResourceTypeStrings + kResourceTypeStringsLength, |
| 1282 type_str); | 1284 type_str); |
| 1283 if (iter == (kResourceTypeStrings + kResourceTypeStringsLength)) | 1285 if (iter == (kResourceTypeStrings + kResourceTypeStringsLength)) |
| 1284 return false; | 1286 return false; |
| 1285 *type = kResourceTypeValues[iter - kResourceTypeStrings]; | 1287 *type = kResourceTypeValues[iter - kResourceTypeStrings]; |
| 1286 return true; | 1288 return true; |
| 1287 } | 1289 } |
| 1288 | 1290 |
| 1289 } // namespace extension_web_request_api_helpers | 1291 } // namespace extension_web_request_api_helpers |
| OLD | NEW |