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

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

Issue 339973003: Remove --enable-service-worker flag (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 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 | Annotate | Revision Log
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/browser/service_worker/service_worker_utils.h" 5 #include "content/browser/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 "content/public/common/content_switches.h" 11 #include "content/public/common/content_switches.h"
12 #include "url/gurl.h" 12 #include "url/gurl.h"
13 13
14 namespace content { 14 namespace content {
15 15
16 // static 16 // static
17 bool ServiceWorkerUtils::IsFeatureEnabled() {
18 static bool enabled = CommandLine::ForCurrentProcess()->HasSwitch(
19 switches::kEnableServiceWorker);
20 return enabled;
21 }
22
23 // static
24 bool ServiceWorkerUtils::ScopeMatches(const GURL& scope, const GURL& url) { 17 bool ServiceWorkerUtils::ScopeMatches(const GURL& scope, const GURL& url) {
25 DCHECK(!scope.has_ref()); 18 DCHECK(!scope.has_ref());
26 DCHECK(!url.has_ref()); 19 DCHECK(!url.has_ref());
27 const std::string& scope_spec = scope.spec(); 20 const std::string& scope_spec = scope.spec();
28 const std::string& url_spec = url.spec(); 21 const std::string& url_spec = url.spec();
29 22
30 size_t len = scope_spec.size(); 23 size_t len = scope_spec.size();
31 if (len > 0 && scope_spec[len - 1] == '*') 24 if (len > 0 && scope_spec[len - 1] == '*')
32 return scope_spec.compare(0, len - 1, url_spec, 0, len - 1) == 0; 25 return scope_spec.compare(0, len - 1, url_spec, 0, len - 1) == 0;
33 return scope_spec == url_spec; 26 return scope_spec == url_spec;
(...skipping 22 matching lines...) Expand all
56 // (https://github.com/slightlyoff/ServiceWorker/issues/287) 49 // (https://github.com/slightlyoff/ServiceWorker/issues/287)
57 if (match_spec.size() == scope_spec.size() && match_spec < scope_spec) { 50 if (match_spec.size() == scope_spec.size() && match_spec < scope_spec) {
58 match_ = scope; 51 match_ = scope;
59 return true; 52 return true;
60 } 53 }
61 54
62 return false; 55 return false;
63 } 56 }
64 57
65 } // namespace content 58 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/service_worker/service_worker_utils.h ('k') | content/browser/worker_host/worker_process_host.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698