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

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

Issue 1200393002: Add more string_util functions to base namespace. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@string
Patch Set: Android 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
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 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 97
98 AppCacheNamespace::~AppCacheNamespace() { 98 AppCacheNamespace::~AppCacheNamespace() {
99 } 99 }
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 base::ReplaceSubstringsAfterOffset(&pattern, 0, "?", "\\?");
108 return MatchPattern(url.spec(), pattern); 108 return MatchPattern(url.spec(), pattern);
109 } 109 }
110 return base::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
(...skipping 12 matching lines...) Expand all
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/browser/geolocation/wifi_data_provider_linux.cc ('k') | content/public/test/test_launcher.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698