| OLD | NEW |
| 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_piece.h" | 7 #include "base/string_piece.h" |
| 8 #include "base/string_split.h" | 8 #include "base/string_split.h" |
| 9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
| 10 #include "chrome/common/url_constants.h" | 10 #include "chrome/common/url_constants.h" |
| 11 #include "googleurl/src/gurl.h" | 11 #include "googleurl/src/gurl.h" |
| 12 #include "googleurl/src/url_util.h" | 12 #include "googleurl/src/url_util.h" |
| 13 | 13 |
| 14 const char URLPattern::kAllUrlsPattern[] = "<all_urls>"; | 14 const char URLPattern::kAllUrlsPattern[] = "<all_urls>"; |
| 15 | 15 |
| 16 namespace { | 16 namespace { |
| 17 | 17 |
| 18 // TODO(aa): Consider adding chrome-extension? What about more obscure ones | 18 // TODO(aa): Consider adding chrome-extension? What about more obscure ones |
| 19 // like data: and javascript: ? | 19 // like data: and javascript: ? |
| 20 // Note: keep this array in sync with kValidSchemeMasks. | 20 // Note: keep this array in sync with kValidSchemeMasks. |
| 21 const char* kValidSchemes[] = { | 21 const char* kValidSchemes[] = { |
| 22 chrome::kHttpScheme, | 22 chrome::kHttpScheme, |
| 23 chrome::kHttpsScheme, | 23 chrome::kHttpsScheme, |
| 24 chrome::kFileScheme, | 24 chrome::kFileScheme, |
| 25 chrome::kFtpScheme, | 25 chrome::kFtpScheme, |
| 26 chrome::kChromeUIScheme, | 26 chrome::kChromeUIScheme, |
| 27 chrome::kFileSystemScheme, |
| 27 }; | 28 }; |
| 28 | 29 |
| 29 const int kValidSchemeMasks[] = { | 30 const int kValidSchemeMasks[] = { |
| 30 URLPattern::SCHEME_HTTP, | 31 URLPattern::SCHEME_HTTP, |
| 31 URLPattern::SCHEME_HTTPS, | 32 URLPattern::SCHEME_HTTPS, |
| 32 URLPattern::SCHEME_FILE, | 33 URLPattern::SCHEME_FILE, |
| 33 URLPattern::SCHEME_FTP, | 34 URLPattern::SCHEME_FTP, |
| 34 URLPattern::SCHEME_CHROMEUI, | 35 URLPattern::SCHEME_CHROMEUI, |
| 36 URLPattern::SCHEME_FILESYSTEM, |
| 35 }; | 37 }; |
| 36 | 38 |
| 37 COMPILE_ASSERT(arraysize(kValidSchemes) == arraysize(kValidSchemeMasks), | 39 COMPILE_ASSERT(arraysize(kValidSchemes) == arraysize(kValidSchemeMasks), |
| 38 must_keep_these_arrays_in_sync); | 40 must_keep_these_arrays_in_sync); |
| 39 | 41 |
| 40 const char* kParseSuccess = "Success."; | 42 const char* kParseSuccess = "Success."; |
| 41 const char* kParseErrorMissingSchemeSeparator = "Missing scheme separator."; | 43 const char* kParseErrorMissingSchemeSeparator = "Missing scheme separator."; |
| 42 const char* kParseErrorInvalidScheme = "Invalid scheme."; | 44 const char* kParseErrorInvalidScheme = "Invalid scheme."; |
| 43 const char* kParseErrorWrongSchemeType = "Wrong scheme type."; | 45 const char* kParseErrorWrongSchemeType = "Wrong scheme type."; |
| 44 const char* kParseErrorEmptyHost = "Host can not be empty."; | 46 const char* kParseErrorEmptyHost = "Host can not be empty."; |
| (...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 348 } | 350 } |
| 349 | 351 |
| 350 return result; | 352 return result; |
| 351 } | 353 } |
| 352 | 354 |
| 353 // static | 355 // static |
| 354 const char* URLPattern::GetParseResultString( | 356 const char* URLPattern::GetParseResultString( |
| 355 URLPattern::ParseResult parse_result) { | 357 URLPattern::ParseResult parse_result) { |
| 356 return kParseResultMessages[parse_result]; | 358 return kParseResultMessages[parse_result]; |
| 357 } | 359 } |
| OLD | NEW |