| Index: components/content_settings/core/common/content_settings_pattern.cc
|
| diff --git a/components/content_settings/core/common/content_settings_pattern.cc b/components/content_settings/core/common/content_settings_pattern.cc
|
| index aa895948153c07fa1536be3d9346c80c9a2462c3..838833fa06e55909f338ccdeb06bdc768a19a9a7 100644
|
| --- a/components/content_settings/core/common/content_settings_pattern.cc
|
| +++ b/components/content_settings/core/common/content_settings_pattern.cc
|
| @@ -21,6 +21,17 @@ namespace {
|
| // The component supports only one scheme for simplicity.
|
| const char* non_port_non_domain_wildcard_scheme = NULL;
|
|
|
| +const char* const kSchemeNames[] = {
|
| + "wildcard",
|
| + url::kHttpScheme,
|
| + url::kHttpsScheme,
|
| + url::kFileScheme,
|
| + "chrome-extension",
|
| +};
|
| +
|
| +static_assert(arraysize(kSchemeNames) == ContentSettingsPattern::SCHEME_MAX - 1,
|
| + "kSchemeNames should have SCHEME_MAX - 1 elements");
|
| +
|
| std::string GetDefaultPort(const std::string& scheme) {
|
| if (scheme == url::kHttpScheme)
|
| return "80";
|
| @@ -590,6 +601,17 @@ std::string ContentSettingsPattern::ToString() const {
|
| return std::string();
|
| }
|
|
|
| +ContentSettingsPattern::SchemeType ContentSettingsPattern::GetScheme() const {
|
| + if (parts_.is_scheme_wildcard)
|
| + return SCHEME_WILDCARD;
|
| +
|
| + for (size_t i = 1; i < arraysize(kSchemeNames); ++i) {
|
| + if (parts_.scheme == kSchemeNames[i])
|
| + return static_cast<SchemeType>(i);
|
| + }
|
| + return SCHEME_OTHER;
|
| +}
|
| +
|
| ContentSettingsPattern::Relation ContentSettingsPattern::Compare(
|
| const ContentSettingsPattern& other) const {
|
| // Two invalid patterns are identical in the way they behave. They don't match
|
|
|