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
3 // found in the LICENSE file.
5 #include "content/browser/service_worker/service_worker_utils.h"
9 #include "base/logging.h"
10 #include "base/strings/string_util.h"
15 bool ServiceWorkerUtils::ScopeMatches(const GURL
& scope
, const GURL
& url
) {
16 DCHECK(!scope
.has_ref());
17 DCHECK(!url
.has_ref());
18 return StartsWithASCII(url
.spec(), scope
.spec(), true);
21 bool LongestScopeMatcher::MatchLongest(const GURL
& scope
) {
22 if (!ServiceWorkerUtils::ScopeMatches(scope
, url_
))
24 if (match_
.is_empty() || match_
.spec().size() < scope
.spec().size()) {
31 } // namespace content