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

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 const ref 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
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>
no sievers 2014/10/29 21:19:58 set is unused
horo 2014/10/30 07:54:35 Done.
9 #include <string>
10 #include <vector>
11
8 #include "base/basictypes.h" 12 #include "base/basictypes.h"
9 #include "base/callback_forward.h" 13 #include "base/callback_forward.h"
10 #include "content/public/browser/service_worker_usage_info.h" 14 #include "content/public/browser/service_worker_usage_info.h"
11 #include "url/gurl.h" 15 #include "url/gurl.h"
12 16
13 namespace content { 17 namespace content {
14 18
15 // Represents the per-StoragePartition ServiceWorker data. Must be used from 19 // Represents the per-StoragePartition ServiceWorker data. Must be used from
16 // the IO thread. 20 // the IO thread except for AddExcludedHeadersForFetchEvent.
Lei Zhang 2014/10/29 21:47:21 With the code as is, do you mean to say "except fo
horo 2014/10/30 07:54:34 Yes but the sentence "Must be used from the IO thr
17 class ServiceWorkerContext { 21 class ServiceWorkerContext {
18 public: 22 public:
19 // https://rawgithub.com/slightlyoff/ServiceWorker/master/spec/service_worker/ index.html#url-scope: 23 // https://rawgithub.com/slightlyoff/ServiceWorker/master/spec/service_worker/ index.html#url-scope:
20 // roughly, must be of the form "<origin>/<path>/*". 24 // roughly, must be of the form "<origin>/<path>/*".
21 typedef GURL Scope; 25 typedef GURL Scope;
22 26
23 typedef base::Callback<void(bool success)> ResultCallback; 27 typedef base::Callback<void(bool success)> ResultCallback;
24 28
25 typedef base::Callback<void(const std::vector<ServiceWorkerUsageInfo>& 29 typedef base::Callback<void(const std::vector<ServiceWorkerUsageInfo>&
26 usage_info)> GetUsageInfoCallback; 30 usage_info)> GetUsageInfoCallback;
27 31
32 // Registers the header name which should not be passed to the ServiceWorker.
33 CONTENT_EXPORT static void AddExcludedHeadersForFetchEvent(
34 const std::vector<std::string>& header_names);
35
36 // Returns true if the header name should not be passed to the ServiceWorker.
37 static bool IsExcludedHeaderNameForFetchEvent(const std::string& header_name);
38
28 // Equivalent to calling navigator.serviceWorker.register(script_url, {scope: 39 // Equivalent to calling navigator.serviceWorker.register(script_url, {scope:
29 // 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
30 // 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
31 // promise is fulfilled or false when the JS promise is rejected. 42 // promise is fulfilled or false when the JS promise is rejected.
32 // 43 //
33 // The registration can fail if: 44 // The registration can fail if:
34 // * |script_url| is on a different origin from |pattern| 45 // * |script_url| is on a different origin from |pattern|
35 // * Fetching |script_url| fails. 46 // * Fetching |script_url| fails.
36 // * |script_url| fails to parse or its top-level execution fails. 47 // * |script_url| fails to parse or its top-level execution fails.
37 // 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 25 matching lines...) Expand all
63 virtual void DeleteForOrigin(const GURL& origin_url) = 0; 74 virtual void DeleteForOrigin(const GURL& origin_url) = 0;
64 75
65 protected: 76 protected:
66 ServiceWorkerContext() {} 77 ServiceWorkerContext() {}
67 virtual ~ServiceWorkerContext() {} 78 virtual ~ServiceWorkerContext() {}
68 }; 79 };
69 80
70 } // namespace content 81 } // namespace content
71 82
72 #endif // CONTENT_PUBLIC_BROWSER_SERVICE_WORKER_CONTEXT_H_ 83 #endif // CONTENT_PUBLIC_BROWSER_SERVICE_WORKER_CONTEXT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698