| Index: content/public/browser/service_worker_context.cc
|
| diff --git a/content/public/browser/service_worker_context.cc b/content/public/browser/service_worker_context.cc
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..d5f07ef368c22fd8a325373f69af44dd849868ef
|
| --- /dev/null
|
| +++ b/content/public/browser/service_worker_context.cc
|
| @@ -0,0 +1,42 @@
|
| +// 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.
|
| +
|
| +#include "content/public/browser/service_worker_context.h"
|
| +
|
| +#include "base/bind.h"
|
| +#include "base/lazy_instance.h"
|
| +#include "content/public/browser/browser_thread.h"
|
| +
|
| +namespace content {
|
| +
|
| +namespace {
|
| +
|
| +typedef std::set<std::string> HeaderNameSet;
|
| +static base::LazyInstance<HeaderNameSet> g_excluded_header_name_set =
|
| + LAZY_INSTANCE_INITIALIZER;
|
| +}
|
| +
|
| +void ServiceWorkerContext::AddExcludedHeadersForFetchEvent(
|
| + const std::vector<std::string> header_names) {
|
| + if (!BrowserThread::CurrentlyOn(BrowserThread::IO)) {
|
| + BrowserThread::PostTask(
|
| + BrowserThread::IO,
|
| + FROM_HERE,
|
| + base::Bind(ServiceWorkerContext::AddExcludedHeadersForFetchEvent,
|
| + header_names));
|
| + return;
|
| + }
|
| + DCHECK_CURRENTLY_ON(BrowserThread::IO);
|
| + g_excluded_header_name_set.Get().insert(header_names.begin(),
|
| + header_names.end());
|
| +}
|
| +
|
| +bool ServiceWorkerContext::IsExcludedHeaderNameForFetchEvent(
|
| + const std::string& header_name) {
|
| + DCHECK_CURRENTLY_ON(BrowserThread::IO);
|
| + return g_excluded_header_name_set.Get().find(header_name) !=
|
| + g_excluded_header_name_set.Get().end();
|
| +}
|
| +
|
| +} // namespace content
|
|
|