Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "extensions/common/extension_messages.h" | 5 #include "extensions/common/extension_messages.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <memory> | 9 #include <memory> |
| 10 | 10 |
| (...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 132 std::string spec; | 132 std::string spec; |
| 133 if (!ReadParam(m, iter, &valid_schemes) || | 133 if (!ReadParam(m, iter, &valid_schemes) || |
| 134 !ReadParam(m, iter, &spec)) | 134 !ReadParam(m, iter, &spec)) |
| 135 return false; | 135 return false; |
| 136 | 136 |
| 137 // TODO(jstritar): We don't want the URLPattern to fail parsing when the | 137 // TODO(jstritar): We don't want the URLPattern to fail parsing when the |
| 138 // scheme is invalid. Instead, the pattern should parse but it should not | 138 // scheme is invalid. Instead, the pattern should parse but it should not |
| 139 // match the invalid patterns. We get around this by setting the valid | 139 // match the invalid patterns. We get around this by setting the valid |
| 140 // schemes after parsing the pattern. Update these method calls once we can | 140 // schemes after parsing the pattern. Update these method calls once we can |
| 141 // ignore scheme validation with URLPattern parse options. crbug.com/90544 | 141 // ignore scheme validation with URLPattern parse options. crbug.com/90544 |
| 142 // Allow effective TLD wildcarding since this check is only needed on initial | |
|
lazyboy
2017/06/30 20:43:22
nit: move this comment to next line as this is tal
nrpeter
2017/06/30 21:22:15
Done.
| |
| 143 // creation of URLPattern and not as part of serialization. | |
|
lazyboy
2017/06/30 20:43:22
nit: this is deserialization, rather than serializ
nrpeter
2017/06/30 21:22:15
Done.
| |
| 142 p->SetValidSchemes(URLPattern::SCHEME_ALL); | 144 p->SetValidSchemes(URLPattern::SCHEME_ALL); |
| 143 URLPattern::ParseResult result = p->Parse(spec); | 145 URLPattern::ParseResult result = |
| 146 p->Parse(spec, URLPattern::ALLOW_WILDCARD_FOR_EFFECTIVE_TLD); | |
| 144 p->SetValidSchemes(valid_schemes); | 147 p->SetValidSchemes(valid_schemes); |
| 145 return URLPattern::PARSE_SUCCESS == result; | 148 return URLPattern::PARSE_SUCCESS == result; |
| 146 } | 149 } |
| 147 | 150 |
| 148 void ParamTraits<URLPattern>::Log(const param_type& p, std::string* l) { | 151 void ParamTraits<URLPattern>::Log(const param_type& p, std::string* l) { |
| 149 LogParam(p.GetAsString(), l); | 152 LogParam(p.GetAsString(), l); |
| 150 } | 153 } |
| 151 | 154 |
| 152 void ParamTraits<URLPatternSet>::GetSize(base::PickleSizer* s, | 155 void ParamTraits<URLPatternSet>::GetSize(base::PickleSizer* s, |
| 153 const param_type& p) { | 156 const param_type& p) { |
| (...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 390 ReadParam(m, iter, &p->policy_allowed_hosts) && | 393 ReadParam(m, iter, &p->policy_allowed_hosts) && |
| 391 ReadParam(m, iter, &p->uses_default_policy_blocked_allowed_hosts); | 394 ReadParam(m, iter, &p->uses_default_policy_blocked_allowed_hosts); |
| 392 } | 395 } |
| 393 | 396 |
| 394 void ParamTraits<ExtensionMsg_Loaded_Params>::Log(const param_type& p, | 397 void ParamTraits<ExtensionMsg_Loaded_Params>::Log(const param_type& p, |
| 395 std::string* l) { | 398 std::string* l) { |
| 396 l->append(p.id); | 399 l->append(p.id); |
| 397 } | 400 } |
| 398 | 401 |
| 399 } // namespace IPC | 402 } // namespace IPC |
| OLD | NEW |