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

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

Issue 10224011: Add transparent support for filesystem URLs in URLPatterns. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Updated MatchesSecurityOrigin and added a comment, as discussed in IM. Created 8 years, 7 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
« no previous file with comments | « no previous file | 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) 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/common/extensions/extension.h" 5 #include "chrome/common/extensions/extension.h"
6 6
7 #include "base/base64.h" 7 #include "base/base64.h"
8 #include "base/basictypes.h" 8 #include "base/basictypes.h"
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/file_path.h" 10 #include "base/file_path.h"
(...skipping 2421 matching lines...) Expand 10 before | Expand all | Expand 10 after
2432 std::string(chrome::kFileSystemScheme) + ':', 2432 std::string(chrome::kFileSystemScheme) + ':',
2433 true)) { 2433 true)) {
2434 *error = ExtensionErrorUtils::FormatErrorMessageUTF16( 2434 *error = ExtensionErrorUtils::FormatErrorMessageUTF16(
2435 errors::kInvalidURLPatternError, filter); 2435 errors::kInvalidURLPatternError, filter);
2436 return NULL; 2436 return NULL;
2437 } 2437 }
2438 // The user inputs filesystem:*; we don't actually implement scheme 2438 // The user inputs filesystem:*; we don't actually implement scheme
2439 // wildcards in URLPattern, so transform to what will match correctly. 2439 // wildcards in URLPattern, so transform to what will match correctly.
2440 filter.replace(0, 11, "chrome-extension://*/"); 2440 filter.replace(0, 11, "chrome-extension://*/");
2441 URLPattern pattern(URLPattern::SCHEME_EXTENSION); 2441 URLPattern pattern(URLPattern::SCHEME_EXTENSION);
2442 pattern.set_partial_filesystem_support_hack(true);
2443 if (pattern.Parse(filter) != URLPattern::PARSE_SUCCESS) { 2442 if (pattern.Parse(filter) != URLPattern::PARSE_SUCCESS) {
2444 *error = ExtensionErrorUtils::FormatErrorMessageUTF16( 2443 *error = ExtensionErrorUtils::FormatErrorMessageUTF16(
2445 errors::kInvalidURLPatternError, filter); 2444 errors::kInvalidURLPatternError, filter);
2446 return NULL; 2445 return NULL;
2447 } 2446 }
2448 std::string path = pattern.path(); 2447 std::string path = pattern.path();
2449 bool allowed = path == "/*" || path == "/*.*" || 2448 bool allowed = path == "/*" || path == "/*.*" ||
2450 (path.compare(0, 3, "/*.") == 0 && 2449 (path.compare(0, 3, "/*.") == 0 &&
2451 path.find_first_of('*', 3) == std::string::npos); 2450 path.find_first_of('*', 3) == std::string::npos);
2452 if (!allowed) { 2451 if (!allowed) {
(...skipping 1201 matching lines...) Expand 10 before | Expand all | Expand 10 after
3654 already_disabled(false), 3653 already_disabled(false),
3655 extension(extension) {} 3654 extension(extension) {}
3656 3655
3657 UpdatedExtensionPermissionsInfo::UpdatedExtensionPermissionsInfo( 3656 UpdatedExtensionPermissionsInfo::UpdatedExtensionPermissionsInfo(
3658 const Extension* extension, 3657 const Extension* extension,
3659 const ExtensionPermissionSet* permissions, 3658 const ExtensionPermissionSet* permissions,
3660 Reason reason) 3659 Reason reason)
3661 : reason(reason), 3660 : reason(reason),
3662 extension(extension), 3661 extension(extension),
3663 permissions(permissions) {} 3662 permissions(permissions) {}
OLDNEW
« no previous file with comments | « no previous file | chrome/common/extensions/url_pattern.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698