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

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

Issue 3750001: base: Move SplitString functions into the base namespace and update the callers. (Closed) Base URL: git://git.chromium.org/chromium.git
Patch Set: brett review, reverted changes in o3d due to it's using an old base revision Created 10 years, 2 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
« no previous file with comments | « chrome/browser/webdata/web_database.cc ('k') | chrome/common/pepper_plugin_registry.cc » ('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) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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"
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
105 path_start_pos = host_start_pos; 105 path_start_pos = host_start_pos;
106 } else { 106 } else {
107 size_t host_end_pos = pattern.find(kPathSeparator, host_start_pos); 107 size_t host_end_pos = pattern.find(kPathSeparator, host_start_pos);
108 if (host_end_pos == std::string::npos) 108 if (host_end_pos == std::string::npos)
109 return false; 109 return false;
110 110
111 host_ = pattern.substr(host_start_pos, host_end_pos - host_start_pos); 111 host_ = pattern.substr(host_start_pos, host_end_pos - host_start_pos);
112 112
113 // The first component can optionally be '*' to match all subdomains. 113 // The first component can optionally be '*' to match all subdomains.
114 std::vector<std::string> host_components; 114 std::vector<std::string> host_components;
115 SplitString(host_, '.', &host_components); 115 base::SplitString(host_, '.', &host_components);
116 if (host_components[0] == "*") { 116 if (host_components[0] == "*") {
117 match_subdomains_ = true; 117 match_subdomains_ = true;
118 host_components.erase(host_components.begin(), 118 host_components.erase(host_components.begin(),
119 host_components.begin() + 1); 119 host_components.begin() + 1);
120 } 120 }
121 host_ = JoinString(host_components, '.'); 121 host_ = JoinString(host_components, '.');
122 122
123 // No other '*' can occur in the host, though. This isn't necessary, but is 123 // No other '*' can occur in the host, though. This isn't necessary, but is
124 // done as a convenience to developers who might otherwise be confused and 124 // done as a convenience to developers who might otherwise be confused and
125 // think '*' works as a glob in the host. 125 // think '*' works as a glob in the host.
(...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after
291 if (MatchesScheme(kValidSchemes[i])) { 291 if (MatchesScheme(kValidSchemes[i])) {
292 URLPattern temp = *this; 292 URLPattern temp = *this;
293 temp.SetScheme(kValidSchemes[i]); 293 temp.SetScheme(kValidSchemes[i]);
294 temp.set_match_all_urls(false); 294 temp.set_match_all_urls(false);
295 result.push_back(temp); 295 result.push_back(temp);
296 } 296 }
297 } 297 }
298 298
299 return result; 299 return result;
300 } 300 }
OLDNEW
« no previous file with comments | « chrome/browser/webdata/web_database.cc ('k') | chrome/common/pepper_plugin_registry.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698