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/strings/string_number_conversions.h" | 10 #include "base/strings/string_number_conversions.h" |
(...skipping 1270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1281 ClearCacheOnNavigationOnUI(); | 1281 ClearCacheOnNavigationOnUI(); |
1282 } else { | 1282 } else { |
1283 content::BrowserThread::PostTask(content::BrowserThread::UI, FROM_HERE, | 1283 content::BrowserThread::PostTask(content::BrowserThread::UI, FROM_HERE, |
1284 base::Bind(&ClearCacheOnNavigationOnUI)); | 1284 base::Bind(&ClearCacheOnNavigationOnUI)); |
1285 } | 1285 } |
1286 } | 1286 } |
1287 | 1287 |
1288 void NotifyWebRequestAPIUsed( | 1288 void NotifyWebRequestAPIUsed( |
1289 void* profile_id, | 1289 void* profile_id, |
1290 scoped_refptr<const extensions::Extension> extension) { | 1290 scoped_refptr<const extensions::Extension> extension) { |
1291 DCHECK(content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)); | 1291 DCHECK_CURRENTLY_ON(content::BrowserThread::UI); |
1292 Profile* profile = reinterpret_cast<Profile*>(profile_id); | 1292 Profile* profile = reinterpret_cast<Profile*>(profile_id); |
1293 if (!g_browser_process->profile_manager()->IsValidProfile(profile)) | 1293 if (!g_browser_process->profile_manager()->IsValidProfile(profile)) |
1294 return; | 1294 return; |
1295 | 1295 |
1296 extensions::RuntimeData* runtime_data = | 1296 extensions::RuntimeData* runtime_data = |
1297 extensions::ExtensionSystem::Get(profile)->runtime_data(); | 1297 extensions::ExtensionSystem::Get(profile)->runtime_data(); |
1298 if (runtime_data->HasUsedWebRequest(extension.get())) | 1298 if (runtime_data->HasUsedWebRequest(extension.get())) |
1299 return; | 1299 return; |
1300 runtime_data->SetHasUsedWebRequest(extension.get(), true); | 1300 runtime_data->SetHasUsedWebRequest(extension.get(), true); |
1301 | 1301 |
(...skipping 12 matching lines...) Expand all Loading... |
1314 return net::HttpUtil::IsToken(name); | 1314 return net::HttpUtil::IsToken(name); |
1315 } | 1315 } |
1316 | 1316 |
1317 bool IsValidHeaderValue(const std::string& value) { | 1317 bool IsValidHeaderValue(const std::string& value) { |
1318 // Just a sanity check: disallow NUL and CRLF. | 1318 // Just a sanity check: disallow NUL and CRLF. |
1319 return value.find('\0') == std::string::npos && | 1319 return value.find('\0') == std::string::npos && |
1320 value.find("\r\n") == std::string::npos; | 1320 value.find("\r\n") == std::string::npos; |
1321 } | 1321 } |
1322 | 1322 |
1323 } // namespace extension_web_request_api_helpers | 1323 } // namespace extension_web_request_api_helpers |
OLD | NEW |