service_worker_utils.h revision a1401311d1ab56c4ed0a474bd38c108f75cb0cd9
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.
4
5#ifndef CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_UTILS_H_
6#define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_UTILS_H_
7
8#include "webkit/common/resource_type.h"
9
10namespace content {
11
12class ServiceWorkerUtils {
13 public:
14  static bool IsMainResourceType(ResourceType::Type type) {
15    return ResourceType::IsFrame(type) ||
16           ResourceType::IsSharedWorker(type);
17  }
18
19  static bool IsServiceWorkerResourceType(ResourceType::Type type) {
20    return ResourceType::IsServiceWorker(type);
21  }
22
23  // Returns true if the feature is enabled (or not disabled) by command-line
24  // flag.
25  static bool IsFeatureEnabled();
26};
27
28}  // namespace content
29
30#endif  // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_UTILS_H_
31