 Chromium Code Reviews
 Chromium Code Reviews Issue 7811006:
  Add full support for filesystem URLs.  (Closed) 
  Base URL: svn://svn.chromium.org/chrome/trunk/src
    
  
    Issue 7811006:
  Add full support for filesystem URLs.  (Closed) 
  Base URL: svn://svn.chromium.org/chrome/trunk/src| Index: chrome/common/extensions/extension.cc | 
| diff --git a/chrome/common/extensions/extension.cc b/chrome/common/extensions/extension.cc | 
| index a31d0b791c96d405fff679339506bb5cc536d5a7..85b313ffb49a4db4ecd46ab58283ad11a2fba70e 100644 | 
| --- a/chrome/common/extensions/extension.cc | 
| +++ b/chrome/common/extensions/extension.cc | 
| @@ -835,16 +835,24 @@ FileBrowserHandler* Extension::LoadFileBrowserHandler( | 
| return NULL; | 
| } | 
| StringToLowerASCII(&filter); | 
| + if (filter.substr(0, 10) != chrome::kFileSystemScheme || | 
| 
Aaron Boodman
2012/03/12 23:17:13
Can you use StartsWith()?
 
ericu
2012/03/13 21:58:47
Done.
 | 
| + filter[10] != ':') { | 
| + *error = ExtensionErrorUtils::FormatErrorMessageUTF16( | 
| + errors::kInvalidURLPatternError, filter); | 
| + return NULL; | 
| + } | 
| + filter.replace(11, 0, "chrome-extension://*/"); | 
| 
Aaron Boodman
2012/03/12 23:21:45
Why?
 
ericu
2012/03/13 21:58:47
Added a comment.
 | 
| URLPattern pattern(URLPattern::SCHEME_FILESYSTEM); | 
| + pattern.SetValidInnerSchemes(URLPattern::SCHEME_EXTENSION); | 
| if (pattern.Parse(filter) != URLPattern::PARSE_SUCCESS) { | 
| *error = ExtensionErrorUtils::FormatErrorMessageUTF16( | 
| errors::kInvalidURLPatternError, filter); | 
| return NULL; | 
| } | 
| std::string path = pattern.path(); | 
| - bool allowed = path == "*" || path == "*.*" || | 
| - (path.compare(0, 2, "*.") == 0 && | 
| - path.find_first_of('*', 2) == std::string::npos); | 
| + bool allowed = path == "/*" || path == "/*.*" || | 
| + (path.compare(0, 3, "/*.") == 0 && | 
| + path.find_first_of('*', 3) == std::string::npos); | 
| if (!allowed) { | 
| *error = ExtensionErrorUtils::FormatErrorMessageUTF16( | 
| errors::kInvalidURLPatternError, filter); |