OLD | NEW |
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" |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
127 const GURL& first = urls.front(); | 127 const GURL& first = urls.front(); |
128 for (const GURL& url : urls) { | 128 for (const GURL& url : urls) { |
129 if (first.GetOrigin() != url.GetOrigin()) | 129 if (first.GetOrigin() != url.GetOrigin()) |
130 return false; | 130 return false; |
131 } | 131 } |
132 return true; | 132 return true; |
133 } | 133 } |
134 | 134 |
135 // static | 135 // static |
136 bool ServiceWorkerUtils::IsMojoForServiceWorkerEnabled() { | 136 bool ServiceWorkerUtils::IsMojoForServiceWorkerEnabled() { |
137 return !base::CommandLine::ForCurrentProcess()->HasSwitch( | 137 return base::CommandLine::ForCurrentProcess()->HasSwitch( |
138 switches::kDisableMojoServiceWorker); | 138 switches::kMojoServiceWorker); |
139 } | 139 } |
140 | 140 |
141 bool LongestScopeMatcher::MatchLongest(const GURL& scope) { | 141 bool LongestScopeMatcher::MatchLongest(const GURL& scope) { |
142 if (!ServiceWorkerUtils::ScopeMatches(scope, url_)) | 142 if (!ServiceWorkerUtils::ScopeMatches(scope, url_)) |
143 return false; | 143 return false; |
144 if (match_.is_empty() || match_.spec().size() < scope.spec().size()) { | 144 if (match_.is_empty() || match_.spec().size() < scope.spec().size()) { |
145 match_ = scope; | 145 match_ = scope; |
146 return true; | 146 return true; |
147 } | 147 } |
148 return false; | 148 return false; |
149 } | 149 } |
150 | 150 |
151 } // namespace content | 151 } // namespace content |
OLD | NEW |