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

Side by Side Diff: components/content_settings/core/common/content_settings_pattern.cc

Issue 1767423002: [Do not commit] Track revocations in content_settings::Observer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 9 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 "components/content_settings/core/common/content_settings_pattern.h" 5 #include "components/content_settings/core/common/content_settings_pattern.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <vector> 9 #include <vector>
10 10
(...skipping 511 matching lines...) Expand 10 before | Expand all | Expand 10 after
522 return false; 522 return false;
523 } 523 }
524 524
525 return true; 525 return true;
526 } 526 }
527 527
528 bool ContentSettingsPattern::MatchesAllHosts() const { 528 bool ContentSettingsPattern::MatchesAllHosts() const {
529 return parts_.has_domain_wildcard && parts_.host.empty(); 529 return parts_.has_domain_wildcard && parts_.host.empty();
530 } 530 }
531 531
532 bool ContentSettingsPattern::HasNoWildcard() const {
533 return !parts_.is_scheme_wildcard && !parts_.has_domain_wildcard &&
534 !parts_.is_port_wildcard && !parts_.is_path_wildcard;
535 }
536
532 std::string ContentSettingsPattern::ToString() const { 537 std::string ContentSettingsPattern::ToString() const {
533 if (IsValid()) 538 if (IsValid())
534 return content_settings::PatternParser::ToString(parts_); 539 return content_settings::PatternParser::ToString(parts_);
535 else 540 else
536 return std::string(); 541 return std::string();
537 } 542 }
538 543
539 ContentSettingsPattern::Relation ContentSettingsPattern::Compare( 544 ContentSettingsPattern::Relation ContentSettingsPattern::Compare(
540 const ContentSettingsPattern& other) const { 545 const ContentSettingsPattern& other) const {
541 // Two invalid patterns are identical in the way they behave. They don't match 546 // Two invalid patterns are identical in the way they behave. They don't match
(...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after
737 if (!parts.is_path_wildcard && other_parts.is_path_wildcard) 742 if (!parts.is_path_wildcard && other_parts.is_path_wildcard)
738 return ContentSettingsPattern::PREDECESSOR; 743 return ContentSettingsPattern::PREDECESSOR;
739 744
740 int result = parts.path.compare(other_parts.path); 745 int result = parts.path.compare(other_parts.path);
741 if (result == 0) 746 if (result == 0)
742 return ContentSettingsPattern::IDENTITY; 747 return ContentSettingsPattern::IDENTITY;
743 if (result > 0) 748 if (result > 0)
744 return ContentSettingsPattern::DISJOINT_ORDER_PRE; 749 return ContentSettingsPattern::DISJOINT_ORDER_PRE;
745 return ContentSettingsPattern::DISJOINT_ORDER_POST; 750 return ContentSettingsPattern::DISJOINT_ORDER_POST;
746 } 751 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698