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

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

Issue 8800006: Support chrome-extension:// scheme in URLPattern. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed merge issues in unit tests 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
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"
11 #include "chrome/common/url_constants.h" 11 #include "chrome/common/url_constants.h"
12 #include "googleurl/src/gurl.h" 12 #include "googleurl/src/gurl.h"
13 #include "googleurl/src/url_util.h" 13 #include "googleurl/src/url_util.h"
14 14
15 const char URLPattern::kAllUrlsPattern[] = "<all_urls>"; 15 const char URLPattern::kAllUrlsPattern[] = "<all_urls>";
16 16
17 namespace { 17 namespace {
18 18
19 // TODO(aa): Consider adding chrome-extension? What about more obscure ones 19 // TODO(aa): What about more obscure schemes like data: and javascript: ?
20 // like data: and javascript: ?
21 // Note: keep this array in sync with kValidSchemeMasks. 20 // Note: keep this array in sync with kValidSchemeMasks.
22 const char* kValidSchemes[] = { 21 const char* kValidSchemes[] = {
23 chrome::kHttpScheme, 22 chrome::kHttpScheme,
24 chrome::kHttpsScheme, 23 chrome::kHttpsScheme,
25 chrome::kFileScheme, 24 chrome::kFileScheme,
26 chrome::kFtpScheme, 25 chrome::kFtpScheme,
27 chrome::kChromeUIScheme, 26 chrome::kChromeUIScheme,
27 chrome::kExtensionScheme,
28 chrome::kFileSystemScheme, 28 chrome::kFileSystemScheme,
29 }; 29 };
30 30
31 const int kValidSchemeMasks[] = { 31 const int kValidSchemeMasks[] = {
32 URLPattern::SCHEME_HTTP, 32 URLPattern::SCHEME_HTTP,
33 URLPattern::SCHEME_HTTPS, 33 URLPattern::SCHEME_HTTPS,
34 URLPattern::SCHEME_FILE, 34 URLPattern::SCHEME_FILE,
35 URLPattern::SCHEME_FTP, 35 URLPattern::SCHEME_FTP,
36 URLPattern::SCHEME_CHROMEUI, 36 URLPattern::SCHEME_CHROMEUI,
37 URLPattern::SCHEME_EXTENSION,
37 URLPattern::SCHEME_FILESYSTEM, 38 URLPattern::SCHEME_FILESYSTEM,
38 }; 39 };
39 40
40 COMPILE_ASSERT(arraysize(kValidSchemes) == arraysize(kValidSchemeMasks), 41 COMPILE_ASSERT(arraysize(kValidSchemes) == arraysize(kValidSchemeMasks),
41 must_keep_these_arrays_in_sync); 42 must_keep_these_arrays_in_sync);
42 43
43 const char kParseSuccess[] = "Success."; 44 const char kParseSuccess[] = "Success.";
44 const char kParseErrorMissingSchemeSeparator[] = "Missing scheme separator."; 45 const char kParseErrorMissingSchemeSeparator[] = "Missing scheme separator.";
45 const char kParseErrorInvalidScheme[] = "Invalid scheme."; 46 const char kParseErrorInvalidScheme[] = "Invalid scheme.";
46 const char kParseErrorWrongSchemeType[] = "Wrong scheme type."; 47 const char kParseErrorWrongSchemeType[] = "Wrong scheme type.";
(...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after
511 } 512 }
512 513
513 return result; 514 return result;
514 } 515 }
515 516
516 // static 517 // static
517 const char* URLPattern::GetParseResultString( 518 const char* URLPattern::GetParseResultString(
518 URLPattern::ParseResult parse_result) { 519 URLPattern::ParseResult parse_result) {
519 return kParseResultMessages[parse_result]; 520 return kParseResultMessages[parse_result];
520 } 521 }
OLDNEW
« no previous file with comments | « chrome/common/extensions/url_pattern.h ('k') | chrome/common/extensions/url_pattern_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698