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

Side by Side Diff: content/public/browser/service_worker_context.h

Issue 666973003: [ServiceWorker] Don't send the UMA related headers to the ServiceWorker. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: use set Created 6 years, 1 month 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
« no previous file with comments | « content/browser/service_worker/service_worker_url_request_job.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 #ifndef CONTENT_PUBLIC_BROWSER_SERVICE_WORKER_CONTEXT_H_ 5 #ifndef CONTENT_PUBLIC_BROWSER_SERVICE_WORKER_CONTEXT_H_
6 #define CONTENT_PUBLIC_BROWSER_SERVICE_WORKER_CONTEXT_H_ 6 #define CONTENT_PUBLIC_BROWSER_SERVICE_WORKER_CONTEXT_H_
7 7
8 #include <set>
9 #include <string>
10
8 #include "base/basictypes.h" 11 #include "base/basictypes.h"
9 #include "base/callback_forward.h" 12 #include "base/callback_forward.h"
10 #include "content/public/browser/service_worker_usage_info.h" 13 #include "content/public/browser/service_worker_usage_info.h"
11 #include "url/gurl.h" 14 #include "url/gurl.h"
12 15
13 namespace content { 16 namespace content {
14 17
15 // Represents the per-StoragePartition ServiceWorker data. 18 // Represents the per-StoragePartition ServiceWorker data.
16 class ServiceWorkerContext { 19 class ServiceWorkerContext {
17 public: 20 public:
18 // https://rawgithub.com/slightlyoff/ServiceWorker/master/spec/service_worker/ index.html#url-scope: 21 // https://rawgithub.com/slightlyoff/ServiceWorker/master/spec/service_worker/ index.html#url-scope:
19 // roughly, must be of the form "<origin>/<path>/*". 22 // roughly, must be of the form "<origin>/<path>/*".
20 typedef GURL Scope; 23 typedef GURL Scope;
21 24
22 typedef base::Callback<void(bool success)> ResultCallback; 25 typedef base::Callback<void(bool success)> ResultCallback;
23 26
24 typedef base::Callback<void(const std::vector<ServiceWorkerUsageInfo>& 27 typedef base::Callback<void(const std::vector<ServiceWorkerUsageInfo>&
25 usage_info)> GetUsageInfoCallback; 28 usage_info)> GetUsageInfoCallback;
26 29
30 // Registers the header name which should not be passed to the ServiceWorker.
31 // Must be called from the IO thread.
32 CONTENT_EXPORT static void AddExcludedHeadersForFetchEvent(
33 const std::set<std::string>& header_names);
34
35 // Returns true if the header name should not be passed to the ServiceWorker.
36 // Must be called from the IO thread.
37 static bool IsExcludedHeaderNameForFetchEvent(const std::string& header_name);
38
27 // Equivalent to calling navigator.serviceWorker.register(script_url, {scope: 39 // Equivalent to calling navigator.serviceWorker.register(script_url, {scope:
28 // pattern}) from a renderer, except that |pattern| is an absolute URL instead 40 // pattern}) from a renderer, except that |pattern| is an absolute URL instead
29 // of relative to some current origin. |callback| is passed true when the JS 41 // of relative to some current origin. |callback| is passed true when the JS
30 // promise is fulfilled or false when the JS promise is rejected. 42 // promise is fulfilled or false when the JS promise is rejected.
31 // 43 //
32 // The registration can fail if: 44 // The registration can fail if:
33 // * |script_url| is on a different origin from |pattern| 45 // * |script_url| is on a different origin from |pattern|
34 // * Fetching |script_url| fails. 46 // * Fetching |script_url| fails.
35 // * |script_url| fails to parse or its top-level execution fails. 47 // * |script_url| fails to parse or its top-level execution fails.
36 // TODO: The error message for this needs to be available to developers. 48 // TODO: The error message for this needs to be available to developers.
(...skipping 20 matching lines...) Expand all
57 virtual void DeleteForOrigin(const GURL& origin_url) = 0; 69 virtual void DeleteForOrigin(const GURL& origin_url) = 0;
58 70
59 protected: 71 protected:
60 ServiceWorkerContext() {} 72 ServiceWorkerContext() {}
61 virtual ~ServiceWorkerContext() {} 73 virtual ~ServiceWorkerContext() {}
62 }; 74 };
63 75
64 } // namespace content 76 } // namespace content
65 77
66 #endif // CONTENT_PUBLIC_BROWSER_SERVICE_WORKER_CONTEXT_H_ 78 #endif // CONTENT_PUBLIC_BROWSER_SERVICE_WORKER_CONTEXT_H_
OLDNEW
« no previous file with comments | « content/browser/service_worker/service_worker_url_request_job.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698