Chromium Code Reviews| Index: chrome/common/content_settings_pattern.h |
| diff --git a/chrome/common/content_settings_pattern.h b/chrome/common/content_settings_pattern.h |
| index a7b4861455efa28dd31564bf63f8b7b205ae8378..9e1ceae33b79488af99d545d79427304dd7fc87e 100644 |
| --- a/chrome/common/content_settings_pattern.h |
| +++ b/chrome/common/content_settings_pattern.h |
| @@ -7,25 +7,16 @@ |
| #ifndef CHROME_COMMON_CONTENT_SETTINGS_PATTERN_H_ |
| #define CHROME_COMMON_CONTENT_SETTINGS_PATTERN_H_ |
| -#include <ostream> |
| #include <string> |
| -#include "base/basictypes.h" |
| -#include "base/compiler_specific.h" |
| #include "base/gtest_prod_util.h" |
| class GURL; |
| -class Pickle; |
| -class PickleIterator; |
| namespace content_settings { |
| class PatternParser; |
| } |
| -namespace IPC { |
| -class Message; |
| -} |
| - |
| // A pattern used in content setting rules. See |IsValid| for a description of |
| // possible patterns. |
| class ContentSettingsPattern { |
| @@ -131,12 +122,6 @@ class ContentSettingsPattern { |
| // The version of the pattern format implemented. |
| static const int kContentSettingsPatternVersion; |
| - // The format of a domain wildcard. |
| - static const char* kDomainWildcard; |
| - |
| - // The length of kDomainWildcard (without the trailing '\0'). |
| - static const size_t kDomainWildcardLength; |
| - |
| // Returns a wildcard content settings pattern that matches all possible valid |
| // origins. |
| static ContentSettingsPattern Wildcard(); |
| @@ -159,17 +144,10 @@ class ContentSettingsPattern { |
| // - [a:b:c:d:e:f:g:h] (matches an exact IPv6 ip) |
| static ContentSettingsPattern FromString(const std::string& pattern_spec); |
| - static ContentSettingsPattern LegacyFromString( |
| - const std::string& pattern_spec); |
| - |
| // Constructs an empty pattern. Empty patterns are invalid patterns. Invalid |
| // patterns match nothing. |
| ContentSettingsPattern(); |
| - // Serializes the pattern to an IPC message or deserializes it. |
| - void WriteToMessage(IPC::Message* m) const; |
| - bool ReadFromMessage(const IPC::Message* m, PickleIterator* iter); |
| - |
| // True if this is a valid pattern. |
| bool IsValid() const { return is_valid_; } |
| @@ -180,7 +158,7 @@ class ContentSettingsPattern { |
| bool MatchesAllHosts() const; |
| // Returns a std::string representation of this pattern. |
| - const std::string ToString() const; |
| + std::string ToString() const; |
|
vabr (Chromium)
2014/08/20 09:52:22
Please keep the return type const. This makes the
vasilii
2014/08/21 14:58:02
It won't compile any way because pattern.ToString(
|
| // Compares the pattern with a given |other| pattern and returns the |
| // |Relation| of the two patterns. |
| @@ -200,54 +178,10 @@ class ContentSettingsPattern { |
| private: |
| friend class content_settings::PatternParser; |
| - friend class Builder; |
| + friend class ContentSettingsPatternSerializer; |
| FRIEND_TEST_ALL_PREFIXES(ContentSettingsPatternParserTest, SerializePatterns); |
| - class Builder : public BuilderInterface { |
| - public: |
| - explicit Builder(bool use_legacy_validate); |
| - virtual ~Builder(); |
| - |
| - // Overrides BuilderInterface |
| - virtual BuilderInterface* WithPort(const std::string& port) OVERRIDE; |
| - |
| - virtual BuilderInterface* WithPortWildcard() OVERRIDE; |
| - |
| - virtual BuilderInterface* WithHost(const std::string& host) OVERRIDE; |
| - |
| - virtual BuilderInterface* WithDomainWildcard() OVERRIDE; |
| - |
| - virtual BuilderInterface* WithScheme(const std::string& scheme) OVERRIDE; |
| - |
| - virtual BuilderInterface* WithSchemeWildcard() OVERRIDE; |
| - |
| - virtual BuilderInterface* WithPath(const std::string& path) OVERRIDE; |
| - |
| - virtual BuilderInterface* WithPathWildcard() OVERRIDE; |
| - |
| - virtual BuilderInterface* Invalid() OVERRIDE; |
| - |
| - virtual ContentSettingsPattern Build() OVERRIDE; |
| - |
| - private: |
| - // Canonicalizes the pattern parts so that they are ASCII only, either |
| - // in original (if it was already ASCII) or punycode form. Returns true if |
| - // the canonicalization was successful. |
| - static bool Canonicalize(PatternParts* parts); |
| - |
| - // Returns true when the pattern |parts| represent a valid pattern. |
| - static bool Validate(const PatternParts& parts); |
| - |
| - static bool LegacyValidate(const PatternParts& parts); |
| - |
| - bool is_valid_; |
| - |
| - bool use_legacy_validate_; |
| - |
| - PatternParts parts_; |
| - |
| - DISALLOW_COPY_AND_ASSIGN(Builder); |
| - }; |
| + class Builder; |
| static Relation CompareScheme( |
| const ContentSettingsPattern::PatternParts& parts, |
| @@ -270,11 +204,4 @@ class ContentSettingsPattern { |
| bool is_valid_; |
| }; |
| -// Stream operator so ContentSettingsPattern can be used in assertion |
| -// statements. |
| -inline std::ostream& operator<<( |
| - std::ostream& out, const ContentSettingsPattern& pattern) { |
| - return out << pattern.ToString(); |
| -} |
| - |
| #endif // CHROME_COMMON_CONTENT_SETTINGS_PATTERN_H_ |