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

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

Issue 7811006: Add full support for filesystem URLs. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merged out; haven't built yet. Created 8 years, 11 months 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
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/url_pattern.h" 5 #include "chrome/common/extensions/url_pattern.h"
6 6
7 #include "base/string_number_conversions.h" 7 #include "base/string_number_conversions.h"
8 #include "base/string_piece.h" 8 #include "base/string_piece.h"
9 #include "base/string_split.h" 9 #include "base/string_split.h"
10 #include "base/string_util.h" 10 #include "base/string_util.h"
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 scheme_end_pos = pattern.find(':'); 146 scheme_end_pos = pattern.find(':');
147 has_standard_scheme_separator = false; 147 has_standard_scheme_separator = false;
148 } 148 }
149 149
150 if (scheme_end_pos == std::string::npos) 150 if (scheme_end_pos == std::string::npos)
151 return PARSE_ERROR_MISSING_SCHEME_SEPARATOR; 151 return PARSE_ERROR_MISSING_SCHEME_SEPARATOR;
152 152
153 if (!SetScheme(pattern.substr(0, scheme_end_pos))) 153 if (!SetScheme(pattern.substr(0, scheme_end_pos)))
154 return PARSE_ERROR_INVALID_SCHEME; 154 return PARSE_ERROR_INVALID_SCHEME;
155 155
156 // TODO(ericu): This will fail on filesystem URLs. What should it do?
Aaron Boodman 2012/01/19 23:47:37 Well, there aren't any places right now where we a
156 bool standard_scheme = IsStandardScheme(scheme_); 157 bool standard_scheme = IsStandardScheme(scheme_);
157 if (standard_scheme != has_standard_scheme_separator) 158 if (standard_scheme != has_standard_scheme_separator)
158 return PARSE_ERROR_WRONG_SCHEME_SEPARATOR; 159 return PARSE_ERROR_WRONG_SCHEME_SEPARATOR;
159 160
160 // Advance past the scheme separator. 161 // Advance past the scheme separator.
161 scheme_end_pos += 162 scheme_end_pos +=
162 (standard_scheme ? strlen(chrome::kStandardSchemeSeparator) : 1); 163 (standard_scheme ? strlen(chrome::kStandardSchemeSeparator) : 1);
163 if (scheme_end_pos >= pattern.size()) 164 if (scheme_end_pos >= pattern.size())
164 return PARSE_ERROR_EMPTY_HOST; 165 return PARSE_ERROR_EMPTY_HOST;
165 166
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after
489 } 490 }
490 491
491 return result; 492 return result;
492 } 493 }
493 494
494 // static 495 // static
495 const char* URLPattern::GetParseResultString( 496 const char* URLPattern::GetParseResultString(
496 URLPattern::ParseResult parse_result) { 497 URLPattern::ParseResult parse_result) {
497 return kParseResultMessages[parse_result]; 498 return kParseResultMessages[parse_result];
498 } 499 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698