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 std::unique_ptr<ContentSettingsPattern::BuilderInterface> builder = |
49 ContentSettingsPattern::CreateBuilder(false)); | 49 ContentSettingsPattern::CreateBuilder(); |
50 builder->WithHost(url_pattern.host()); | 50 builder->WithHost(url_pattern.host()); |
51 if (url_pattern.match_subdomains()) | 51 if (url_pattern.match_subdomains()) |
52 builder->WithDomainWildcard(); | 52 builder->WithDomainWildcard(); |
53 | 53 |
54 std::string scheme = url_pattern.scheme(); | 54 std::string scheme = url_pattern.scheme(); |
55 if (scheme == "*") | 55 if (scheme == "*") |
56 builder->WithSchemeWildcard(); | 56 builder->WithSchemeWildcard(); |
57 else | 57 else |
58 builder->WithScheme(scheme); | 58 builder->WithScheme(scheme); |
59 | 59 |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
103 } | 103 } |
104 | 104 |
105 std::string ContentSettingsTypeToString(ContentSettingsType type) { | 105 std::string ContentSettingsTypeToString(ContentSettingsType type) { |
106 return content_settings::WebsiteSettingsRegistry::GetInstance() | 106 return content_settings::WebsiteSettingsRegistry::GetInstance() |
107 ->Get(type) | 107 ->Get(type) |
108 ->name(); | 108 ->name(); |
109 } | 109 } |
110 | 110 |
111 } // namespace content_settings_helpers | 111 } // namespace content_settings_helpers |
112 } // namespace extensions | 112 } // namespace extensions |
OLD | NEW |