| 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 true; |
| 138 switches::kDisableMojoServiceWorker); | |
| 139 } | 138 } |
| 140 | 139 |
| 141 bool LongestScopeMatcher::MatchLongest(const GURL& scope) { | 140 bool LongestScopeMatcher::MatchLongest(const GURL& scope) { |
| 142 if (!ServiceWorkerUtils::ScopeMatches(scope, url_)) | 141 if (!ServiceWorkerUtils::ScopeMatches(scope, url_)) |
| 143 return false; | 142 return false; |
| 144 if (match_.is_empty() || match_.spec().size() < scope.spec().size()) { | 143 if (match_.is_empty() || match_.spec().size() < scope.spec().size()) { |
| 145 match_ = scope; | 144 match_ = scope; |
| 146 return true; | 145 return true; |
| 147 } | 146 } |
| 148 return false; | 147 return false; |
| 149 } | 148 } |
| 150 | 149 |
| 151 } // namespace content | 150 } // namespace content |
| OLD | NEW |