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

Side by Side Diff: content/common/service_worker/service_worker_utils.cc

Issue 2960703003: Add a feature flag for network service and about:flags entry for it. (Closed)
Patch Set: merge Created 3 years, 5 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/service_worker/service_worker_utils.h" 5 #include "content/common/service_worker/service_worker_utils.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/command_line.h" 9 #include "base/command_line.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
11 #include "base/strings/string_util.h" 11 #include "base/strings/string_util.h"
12 #include "content/public/common/browser_side_navigation_policy.h" 12 #include "content/public/common/browser_side_navigation_policy.h"
13 #include "content/public/common/content_features.h"
13 #include "content/public/common/content_switches.h" 14 #include "content/public/common/content_switches.h"
14 #include "content/public/common/origin_util.h" 15 #include "content/public/common/origin_util.h"
15 16
16 namespace content { 17 namespace content {
17 18
18 namespace { 19 namespace {
19 20
20 bool PathContainsDisallowedCharacter(const GURL& url) { 21 bool PathContainsDisallowedCharacter(const GURL& url) {
21 std::string path = url.path(); 22 std::string path = url.path();
22 DCHECK(base::IsStringUTF8(path)); 23 DCHECK(base::IsStringUTF8(path));
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
130 for (const GURL& url : urls) { 131 for (const GURL& url : urls) {
131 if (first.GetOrigin() != url.GetOrigin()) 132 if (first.GetOrigin() != url.GetOrigin())
132 return false; 133 return false;
133 } 134 }
134 return true; 135 return true;
135 } 136 }
136 137
137 // static 138 // static
138 bool ServiceWorkerUtils::IsServicificationEnabled() { 139 bool ServiceWorkerUtils::IsServicificationEnabled() {
139 return IsBrowserSideNavigationEnabled() && 140 return IsBrowserSideNavigationEnabled() &&
140 base::CommandLine::ForCurrentProcess()->HasSwitch( 141 base::FeatureList::IsEnabled(features::kNetworkService);
141 switches::kEnableNetworkService);
142 } 142 }
143 143
144 // static 144 // static
145 bool ServiceWorkerUtils::IsMojoForServiceWorkerEnabled() { 145 bool ServiceWorkerUtils::IsMojoForServiceWorkerEnabled() {
146 return true; 146 return true;
147 } 147 }
148 148
149 bool LongestScopeMatcher::MatchLongest(const GURL& scope) { 149 bool LongestScopeMatcher::MatchLongest(const GURL& scope) {
150 if (!ServiceWorkerUtils::ScopeMatches(scope, url_)) 150 if (!ServiceWorkerUtils::ScopeMatches(scope, url_))
151 return false; 151 return false;
152 if (match_.is_empty() || match_.spec().size() < scope.spec().size()) { 152 if (match_.is_empty() || match_.spec().size() < scope.spec().size()) {
153 match_ = scope; 153 match_ = scope;
154 return true; 154 return true;
155 } 155 }
156 return false; 156 return false;
157 } 157 }
158 158
159 } // namespace content 159 } // namespace content
OLDNEW
« no previous file with comments | « content/child/runtime_features.cc ('k') | content/public/common/browser_side_navigation_policy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698