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

Side by Side Diff: extensions/browser/api/declarative_webrequest/webrequest_condition_attribute.cc

Issue 1182183003: Move EndsWith to base namespace. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 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
« no previous file with comments | « dbus/string_util.cc ('k') | extensions/browser/api/web_request/web_request_permissions.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "extensions/browser/api/declarative_webrequest/webrequest_condition_att ribute.h" 5 #include "extensions/browser/api/declarative_webrequest/webrequest_condition_att ribute.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/lazy_instance.h" 9 #include "base/lazy_instance.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 406 matching lines...) Expand 10 before | Expand all | Expand 10 after
417 } 417 }
418 418
419 HeaderMatcher::StringMatchTest::~StringMatchTest() {} 419 HeaderMatcher::StringMatchTest::~StringMatchTest() {}
420 420
421 bool HeaderMatcher::StringMatchTest::Matches( 421 bool HeaderMatcher::StringMatchTest::Matches(
422 const std::string& str) const { 422 const std::string& str) const {
423 switch (type_) { 423 switch (type_) {
424 case kPrefix: 424 case kPrefix:
425 return base::StartsWithASCII(str, data_, case_sensitive_); 425 return base::StartsWithASCII(str, data_, case_sensitive_);
426 case kSuffix: 426 case kSuffix:
427 return EndsWith(str, data_, case_sensitive_); 427 return base::EndsWith(str, data_, case_sensitive_);
428 case kEquals: 428 case kEquals:
429 return str.size() == data_.size() && 429 return str.size() == data_.size() &&
430 base::StartsWithASCII(str, data_, case_sensitive_); 430 base::StartsWithASCII(str, data_, case_sensitive_);
431 case kContains: 431 case kContains:
432 if (!case_sensitive_) { 432 if (!case_sensitive_) {
433 return std::search(str.begin(), str.end(), data_.begin(), data_.end(), 433 return std::search(str.begin(), str.end(), data_.begin(), data_.end(),
434 CaseInsensitiveCompareASCII<char>()) != str.end(); 434 CaseInsensitiveCompareASCII<char>()) != str.end();
435 } else { 435 } else {
436 return str.find(data_) != std::string::npos; 436 return str.find(data_) != std::string::npos;
437 } 437 }
(...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after
869 bool WebRequestConditionAttributeStages::Equals( 869 bool WebRequestConditionAttributeStages::Equals(
870 const WebRequestConditionAttribute* other) const { 870 const WebRequestConditionAttribute* other) const {
871 if (!WebRequestConditionAttribute::Equals(other)) 871 if (!WebRequestConditionAttribute::Equals(other))
872 return false; 872 return false;
873 const WebRequestConditionAttributeStages* casted_other = 873 const WebRequestConditionAttributeStages* casted_other =
874 static_cast<const WebRequestConditionAttributeStages*>(other); 874 static_cast<const WebRequestConditionAttributeStages*>(other);
875 return allowed_stages_ == casted_other->allowed_stages_; 875 return allowed_stages_ == casted_other->allowed_stages_;
876 } 876 }
877 877
878 } // namespace extensions 878 } // namespace extensions
OLDNEW
« no previous file with comments | « dbus/string_util.cc ('k') | extensions/browser/api/web_request/web_request_permissions.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698