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

Side by Side Diff: content/common/appcache_interfaces.cc

Issue 1172183002: Move StartsWith[ASCII] to base namespace. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@string_util3
Patch Set: merger Created 5 years, 6 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 | « content/child/simple_webmimeregistry_impl.cc ('k') | content/common/plugin_list_mac.mm » ('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 "content/common/appcache_interfaces.h" 5 #include "content/common/appcache_interfaces.h"
6 6
7 #include <set> 7 #include <set>
8 8
9 #include "base/strings/string_util.h" 9 #include "base/strings/string_util.h"
10 #include "content/public/common/url_constants.h" 10 #include "content/public/common/url_constants.h"
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 100
101 bool AppCacheNamespace::IsMatch(const GURL& url) const { 101 bool AppCacheNamespace::IsMatch(const GURL& url) const {
102 if (is_pattern) { 102 if (is_pattern) {
103 // We have to escape '?' characters since MatchPattern also treats those 103 // We have to escape '?' characters since MatchPattern also treats those
104 // as wildcards which we don't want here, we only do '*'s. 104 // as wildcards which we don't want here, we only do '*'s.
105 std::string pattern = namespace_url.spec(); 105 std::string pattern = namespace_url.spec();
106 if (namespace_url.has_query()) 106 if (namespace_url.has_query())
107 ReplaceSubstringsAfterOffset(&pattern, 0, "?", "\\?"); 107 ReplaceSubstringsAfterOffset(&pattern, 0, "?", "\\?");
108 return MatchPattern(url.spec(), pattern); 108 return MatchPattern(url.spec(), pattern);
109 } 109 }
110 return StartsWithASCII(url.spec(), namespace_url.spec(), true); 110 return base::StartsWithASCII(url.spec(), namespace_url.spec(), true);
111 } 111 }
112 112
113 bool IsSchemeSupportedForAppCache(const GURL& url) { 113 bool IsSchemeSupportedForAppCache(const GURL& url) {
114 bool supported = url.SchemeIs(url::kHttpScheme) || 114 bool supported = url.SchemeIs(url::kHttpScheme) ||
115 url.SchemeIs(url::kHttpsScheme) || 115 url.SchemeIs(url::kHttpsScheme) ||
116 url.SchemeIs(kChromeDevToolsScheme); 116 url.SchemeIs(kChromeDevToolsScheme);
117 117
118 #ifndef NDEBUG 118 #ifndef NDEBUG
119 // TODO(michaeln): It would be really nice if this could optionally work for 119 // TODO(michaeln): It would be really nice if this could optionally work for
120 // file and filesystem urls too to help web developers experiment and test 120 // file and filesystem urls too to help web developers experiment and test
121 // their apps, perhaps enabled via a cmd line flag or some other developer 121 // their apps, perhaps enabled via a cmd line flag or some other developer
122 // tool setting. Unfortunately file scheme net::URLRequests don't produce the 122 // tool setting. Unfortunately file scheme net::URLRequests don't produce the
123 // same signalling (200 response codes, headers) as http URLRequests, so this 123 // same signalling (200 response codes, headers) as http URLRequests, so this
124 // doesn't work just yet. 124 // doesn't work just yet.
125 // supported |= url.SchemeIsFile(); 125 // supported |= url.SchemeIsFile();
126 #endif 126 #endif
127 return supported; 127 return supported;
128 } 128 }
129 129
130 bool IsMethodSupportedForAppCache(const std::string& method) { 130 bool IsMethodSupportedForAppCache(const std::string& method) {
131 return (method == kHttpGETMethod) || (method == kHttpHEADMethod); 131 return (method == kHttpGETMethod) || (method == kHttpHEADMethod);
132 } 132 }
133 133
134 bool IsSchemeAndMethodSupportedForAppCache(const net::URLRequest* request) { 134 bool IsSchemeAndMethodSupportedForAppCache(const net::URLRequest* request) {
135 return IsSchemeSupportedForAppCache(request->url()) && 135 return IsSchemeSupportedForAppCache(request->url()) &&
136 IsMethodSupportedForAppCache(request->method()); 136 IsMethodSupportedForAppCache(request->method());
137 } 137 }
138 138
139 } // namespace content 139 } // namespace content
OLDNEW
« no previous file with comments | « content/child/simple_webmimeregistry_impl.cc ('k') | content/common/plugin_list_mac.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698