blob: 38669c4317648145870670961284df7a64f50aed (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
|
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_UTILS_H_
#define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_UTILS_H_
#include "content/common/content_export.h"
#include "content/common/service_worker/service_worker_status_code.h"
#include "webkit/common/resource_type.h"
namespace content {
class ServiceWorkerUtils {
public:
static bool IsMainResourceType(ResourceType::Type type) {
return ResourceType::IsFrame(type) ||
ResourceType::IsSharedWorker(type);
}
static bool IsServiceWorkerResourceType(ResourceType::Type type) {
return ResourceType::IsServiceWorker(type);
}
// Returns true if the feature is enabled (or not disabled) by command-line
// flag.
static bool IsFeatureEnabled();
// A helper for creating a do-nothing status callback.
static void NoOpStatusCallback(ServiceWorkerStatusCode status) {}
// Returns true if |scope| matches |url|.
CONTENT_EXPORT static bool ScopeMatches(const GURL& scope, const GURL& url);
};
} // namespace content
#endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_UTILS_H_
|