| OLD | NEW |
| 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/content_settings/content_settings_helper
s.h" | 5 #include "chrome/browser/extensions/api/content_settings/content_settings_helper
s.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "components/content_settings/core/browser/website_settings_info.h" | 10 #include "components/content_settings/core/browser/website_settings_info.h" |
| (...skipping 27 matching lines...) Expand all Loading... |
| 38 std::string* error) { | 38 std::string* error) { |
| 39 const int kAllowedSchemes = | 39 const int kAllowedSchemes = |
| 40 URLPattern::SCHEME_HTTP | URLPattern::SCHEME_HTTPS | | 40 URLPattern::SCHEME_HTTP | URLPattern::SCHEME_HTTPS | |
| 41 URLPattern::SCHEME_FILE; | 41 URLPattern::SCHEME_FILE; |
| 42 URLPattern url_pattern(kAllowedSchemes); | 42 URLPattern url_pattern(kAllowedSchemes); |
| 43 URLPattern::ParseResult result = url_pattern.Parse(pattern_str); | 43 URLPattern::ParseResult result = url_pattern.Parse(pattern_str); |
| 44 if (result != URLPattern::PARSE_SUCCESS) { | 44 if (result != URLPattern::PARSE_SUCCESS) { |
| 45 *error = URLPattern::GetParseResultString(result); | 45 *error = URLPattern::GetParseResultString(result); |
| 46 return ContentSettingsPattern(); | 46 return ContentSettingsPattern(); |
| 47 } else { | 47 } else { |
| 48 std::unique_ptr<ContentSettingsPattern::BuilderInterface> builder( | 48 auto builder = ContentSettingsPattern::CreateBuilder(); |
| 49 ContentSettingsPattern::CreateBuilder(false)); | |
| 50 builder->WithHost(url_pattern.host()); | 49 builder->WithHost(url_pattern.host()); |
| 51 if (url_pattern.match_subdomains()) | 50 if (url_pattern.match_subdomains()) |
| 52 builder->WithDomainWildcard(); | 51 builder->WithDomainWildcard(); |
| 53 | 52 |
| 54 std::string scheme = url_pattern.scheme(); | 53 std::string scheme = url_pattern.scheme(); |
| 55 if (scheme == "*") | 54 if (scheme == "*") |
| 56 builder->WithSchemeWildcard(); | 55 builder->WithSchemeWildcard(); |
| 57 else | 56 else |
| 58 builder->WithScheme(scheme); | 57 builder->WithScheme(scheme); |
| 59 | 58 |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 } | 102 } |
| 104 | 103 |
| 105 std::string ContentSettingsTypeToString(ContentSettingsType type) { | 104 std::string ContentSettingsTypeToString(ContentSettingsType type) { |
| 106 return content_settings::WebsiteSettingsRegistry::GetInstance() | 105 return content_settings::WebsiteSettingsRegistry::GetInstance() |
| 107 ->Get(type) | 106 ->Get(type) |
| 108 ->name(); | 107 ->name(); |
| 109 } | 108 } |
| 110 | 109 |
| 111 } // namespace content_settings_helpers | 110 } // namespace content_settings_helpers |
| 112 } // namespace extensions | 111 } // namespace extensions |
| OLD | NEW |