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

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

Issue 273193004: Move some content url constants to /url. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 7 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
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"
(...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
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
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698