| 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 409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 420 bool consider_only_cancel_scheme_urls) { | 420 bool consider_only_cancel_scheme_urls) { |
| 421 bool redirected = false; | 421 bool redirected = false; |
| 422 | 422 |
| 423 // Extension that determines the |new_url|. | 423 // Extension that determines the |new_url|. |
| 424 std::string winning_extension_id; | 424 std::string winning_extension_id; |
| 425 EventResponseDeltas::const_iterator delta; | 425 EventResponseDeltas::const_iterator delta; |
| 426 for (delta = deltas.begin(); delta != deltas.end(); ++delta) { | 426 for (delta = deltas.begin(); delta != deltas.end(); ++delta) { |
| 427 if ((*delta)->new_url.is_empty()) | 427 if ((*delta)->new_url.is_empty()) |
| 428 continue; | 428 continue; |
| 429 if (consider_only_cancel_scheme_urls && | 429 if (consider_only_cancel_scheme_urls && |
| 430 !(*delta)->new_url.SchemeIs(content::kDataScheme) && | 430 !(*delta)->new_url.SchemeIs(url::kDataScheme) && |
| 431 (*delta)->new_url.spec() != "about:blank") { | 431 (*delta)->new_url.spec() != "about:blank") { |
| 432 continue; | 432 continue; |
| 433 } | 433 } |
| 434 | 434 |
| 435 if (!redirected || *new_url == (*delta)->new_url) { | 435 if (!redirected || *new_url == (*delta)->new_url) { |
| 436 *new_url = (*delta)->new_url; | 436 *new_url = (*delta)->new_url; |
| 437 winning_extension_id = (*delta)->extension_id; | 437 winning_extension_id = (*delta)->extension_id; |
| 438 redirected = true; | 438 redirected = true; |
| 439 net_log->AddEvent( | 439 net_log->AddEvent( |
| 440 net::NetLog::TYPE_CHROME_EXTENSION_REDIRECTED_REQUEST, | 440 net::NetLog::TYPE_CHROME_EXTENSION_REDIRECTED_REQUEST, |
| (...skipping 873 matching lines...) Expand 10 before | Expand all | Expand 10 after 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 |