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

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

Issue 439843002: Merge 280354 "Have the Debugger extension api check that it has ..." (Closed) Base URL: svn://svn.chromium.org/chrome/branches/2062/src/
Patch Set: Created 6 years, 4 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 | « extensions/common/url_pattern.h ('k') | no next file » | 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 "extensions/common/url_pattern.h" 5 #include "extensions/common/url_pattern.h"
6 6
7 #include "base/strings/string_number_conversions.h" 7 #include "base/strings/string_number_conversions.h"
8 #include "base/strings/string_piece.h" 8 #include "base/strings/string_piece.h"
9 #include "base/strings/string_split.h" 9 #include "base/strings/string_split.h"
10 #include "base/strings/string_util.h" 10 #include "base/strings/string_util.h"
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 // way to solve the general case, but we don't need that yet. 102 // way to solve the general case, but we don't need that yet.
103 std::string StripTrailingWildcard(const std::string& path) { 103 std::string StripTrailingWildcard(const std::string& path) {
104 size_t wildcard_index = path.find('*'); 104 size_t wildcard_index = path.find('*');
105 size_t path_last = path.size() - 1; 105 size_t path_last = path.size() - 1;
106 DCHECK(wildcard_index == std::string::npos || wildcard_index == path_last); 106 DCHECK(wildcard_index == std::string::npos || wildcard_index == path_last);
107 return wildcard_index == path_last ? path.substr(0, path_last) : path; 107 return wildcard_index == path_last ? path.substr(0, path_last) : path;
108 } 108 }
109 109
110 } // namespace 110 } // namespace
111 111
112 // static
113 bool URLPattern::IsValidSchemeForExtensions(const std::string& scheme) {
114 for (size_t i = 0; i < arraysize(kValidSchemes); ++i) {
115 if (scheme == kValidSchemes[i])
116 return true;
117 }
118 return false;
119 }
120
112 URLPattern::URLPattern() 121 URLPattern::URLPattern()
113 : valid_schemes_(SCHEME_NONE), 122 : valid_schemes_(SCHEME_NONE),
114 match_all_urls_(false), 123 match_all_urls_(false),
115 match_subdomains_(false), 124 match_subdomains_(false),
116 port_("*") {} 125 port_("*") {}
117 126
118 URLPattern::URLPattern(int valid_schemes) 127 URLPattern::URLPattern(int valid_schemes)
119 : valid_schemes_(valid_schemes), 128 : valid_schemes_(valid_schemes),
120 match_all_urls_(false), 129 match_all_urls_(false),
121 match_subdomains_(false), 130 match_subdomains_(false),
(...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after
536 } 545 }
537 546
538 return result; 547 return result;
539 } 548 }
540 549
541 // static 550 // static
542 const char* URLPattern::GetParseResultString( 551 const char* URLPattern::GetParseResultString(
543 URLPattern::ParseResult parse_result) { 552 URLPattern::ParseResult parse_result) {
544 return kParseResultMessages[parse_result]; 553 return kParseResultMessages[parse_result];
545 } 554 }
OLDNEW
« no previous file with comments | « extensions/common/url_pattern.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698