Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(42)

Side by Side Diff: chrome/common/extensions/extension_messages.cc

Issue 8885022: Move URLPattern::ParseOption into a field. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: more minor sprucing Created 9 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/common/extensions/extension.cc ('k') | chrome/common/extensions/url_pattern.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/common/extensions/extension_messages.h" 5 #include "chrome/common/extensions/extension_messages.h"
6 6
7 #include "chrome/common/extensions/extension_constants.h" 7 #include "chrome/common/extensions/extension_constants.h"
8 #include "chrome/common/extensions/manifest.h" 8 #include "chrome/common/extensions/manifest.h"
9 #include "content/public/common/common_param_traits.h" 9 #include "content/public/common/common_param_traits.h"
10 10
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after
109 std::string spec; 109 std::string spec;
110 if (!ReadParam(m, iter, &valid_schemes) || 110 if (!ReadParam(m, iter, &valid_schemes) ||
111 !ReadParam(m, iter, &spec)) 111 !ReadParam(m, iter, &spec))
112 return false; 112 return false;
113 113
114 // TODO(jstritar): We don't want the URLPattern to fail parsing when the 114 // TODO(jstritar): We don't want the URLPattern to fail parsing when the
115 // scheme is invalid. Instead, the pattern should parse but it should not 115 // scheme is invalid. Instead, the pattern should parse but it should not
116 // match the invalid patterns. We get around this by setting the valid 116 // match the invalid patterns. We get around this by setting the valid
117 // schemes after parsing the pattern. Update these method calls once we can 117 // schemes after parsing the pattern. Update these method calls once we can
118 // ignore scheme validation with URLPattern parse options. crbug.com/90544 118 // ignore scheme validation with URLPattern parse options. crbug.com/90544
119 p->SetParseOption(URLPattern::IGNORE_PORTS);
119 p->SetValidSchemes(URLPattern::SCHEME_ALL); 120 p->SetValidSchemes(URLPattern::SCHEME_ALL);
120 URLPattern::ParseResult result = p->Parse(spec, URLPattern::IGNORE_PORTS); 121 URLPattern::ParseResult result = p->Parse(spec);
121 p->SetValidSchemes(valid_schemes); 122 p->SetValidSchemes(valid_schemes);
122 return URLPattern::PARSE_SUCCESS == result; 123 return URLPattern::PARSE_SUCCESS == result;
123 } 124 }
124 125
125 void ParamTraits<URLPattern>::Log(const param_type& p, std::string* l) { 126 void ParamTraits<URLPattern>::Log(const param_type& p, std::string* l) {
126 LogParam(p.GetAsString(), l); 127 LogParam(p.GetAsString(), l);
127 } 128 }
128 129
129 void ParamTraits<URLPatternSet>::Write(Message* m, const param_type& p) { 130 void ParamTraits<URLPatternSet>::Write(Message* m, const param_type& p) {
130 WriteParam(m, p.patterns()); 131 WriteParam(m, p.patterns());
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 ReadParam(m, iter, &p->explicit_hosts) && 190 ReadParam(m, iter, &p->explicit_hosts) &&
190 ReadParam(m, iter, &p->scriptable_hosts); 191 ReadParam(m, iter, &p->scriptable_hosts);
191 } 192 }
192 193
193 void ParamTraits<ExtensionMsg_Loaded_Params>::Log(const param_type& p, 194 void ParamTraits<ExtensionMsg_Loaded_Params>::Log(const param_type& p,
194 std::string* l) { 195 std::string* l) {
195 l->append(p.id); 196 l->append(p.id);
196 } 197 }
197 198
198 } // namespace IPC 199 } // namespace IPC
OLDNEW
« no previous file with comments | « chrome/common/extensions/extension.cc ('k') | chrome/common/extensions/url_pattern.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698