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

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

Issue 893793005: Check if there is a SW controlling the start page for app banner. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase and naming / comment tweaks Created 5 years, 10 months 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_context_wrapper.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> 8 #include <set>
9 #include <string> 9 #include <string>
10 10
(...skipping 14 matching lines...) Expand all
25 public: 25 public:
26 // https://rawgithub.com/slightlyoff/ServiceWorker/master/spec/service_worker/ index.html#url-scope: 26 // https://rawgithub.com/slightlyoff/ServiceWorker/master/spec/service_worker/ index.html#url-scope:
27 // roughly, must be of the form "<origin>/<path>/*". 27 // roughly, must be of the form "<origin>/<path>/*".
28 typedef GURL Scope; 28 typedef GURL Scope;
29 29
30 typedef base::Callback<void(bool success)> ResultCallback; 30 typedef base::Callback<void(bool success)> ResultCallback;
31 31
32 typedef base::Callback<void(const std::vector<ServiceWorkerUsageInfo>& 32 typedef base::Callback<void(const std::vector<ServiceWorkerUsageInfo>&
33 usage_info)> GetUsageInfoCallback; 33 usage_info)> GetUsageInfoCallback;
34 34
35 typedef base::Callback<void(bool has_service_worker)>
36 CheckHasServiceWorkerCallback;
37
35 // Registers the header name which should not be passed to the ServiceWorker. 38 // Registers the header name which should not be passed to the ServiceWorker.
36 // Must be called from the IO thread. 39 // Must be called from the IO thread.
37 CONTENT_EXPORT static void AddExcludedHeadersForFetchEvent( 40 CONTENT_EXPORT static void AddExcludedHeadersForFetchEvent(
38 const std::set<std::string>& header_names); 41 const std::set<std::string>& header_names);
39 42
40 // Returns true if the header name should not be passed to the ServiceWorker. 43 // Returns true if the header name should not be passed to the ServiceWorker.
41 // Must be called from the IO thread. 44 // Must be called from the IO thread.
42 static bool IsExcludedHeaderNameForFetchEvent(const std::string& header_name); 45 static bool IsExcludedHeaderNameForFetchEvent(const std::string& header_name);
43 46
44 // Retrieves the ServiceWorkerContext, if any, associated with |request|. 47 // Retrieves the ServiceWorkerContext, if any, associated with |request|.
(...skipping 21 matching lines...) Expand all
66 // fulfilled or false when the JS promise is rejected. 69 // fulfilled or false when the JS promise is rejected.
67 // 70 //
68 // Unregistration can fail if: 71 // Unregistration can fail if:
69 // * No Service Worker was registered for |pattern|. 72 // * No Service Worker was registered for |pattern|.
70 // * Something unexpected goes wrong, like a renderer crash. 73 // * Something unexpected goes wrong, like a renderer crash.
71 virtual void UnregisterServiceWorker(const Scope& pattern, 74 virtual void UnregisterServiceWorker(const Scope& pattern,
72 const ResultCallback& callback) = 0; 75 const ResultCallback& callback) = 0;
73 76
74 // TODO(jyasskin): Provide a way to SendMessage to a Scope. 77 // TODO(jyasskin): Provide a way to SendMessage to a Scope.
75 78
76 // Determines if a request for 'url' can be satisfied while offline. 79 // Determines if a request for |url| can be satisfied while offline.
77 // This method always completes asynchronously. 80 // This method always completes asynchronously.
78 virtual void CanHandleMainResourceOffline(const GURL& url, 81 virtual void CanHandleMainResourceOffline(const GURL& url,
79 const GURL& first_party, 82 const GURL& first_party,
80 const net::CompletionCallback& 83 const net::CompletionCallback&
81 callback) = 0; 84 callback) = 0;
82 85
83 // Methods used in response to browsing data and quota manager requests. 86 // Methods used in response to browsing data and quota manager requests.
84 virtual void GetAllOriginsInfo(const GetUsageInfoCallback& callback) = 0; 87 virtual void GetAllOriginsInfo(const GetUsageInfoCallback& callback) = 0;
85 virtual void DeleteForOrigin(const GURL& origin_url) = 0; 88 virtual void DeleteForOrigin(const GURL& origin_url) = 0;
86 89
90 // Returns true if an active Service Worker registration exists that matches
91 // |url|, and if |other_url| falls inside the scope of the same registration.
92 // Note this still returns true even if there is a Service Worker registration
93 // which has a longer match for |other_url|.
94 // This function can be called from any thread, but the callback will always
95 // be called on the UI thread.
96 virtual void CheckHasServiceWorker(
97 const GURL& url,
98 const GURL& other_url,
99 const CheckHasServiceWorkerCallback& callback) = 0;
100
87 protected: 101 protected:
88 ServiceWorkerContext() {} 102 ServiceWorkerContext() {}
89 virtual ~ServiceWorkerContext() {} 103 virtual ~ServiceWorkerContext() {}
90 }; 104 };
91 105
92 } // namespace content 106 } // namespace content
93 107
94 #endif // CONTENT_PUBLIC_BROWSER_SERVICE_WORKER_CONTEXT_H_ 108 #endif // CONTENT_PUBLIC_BROWSER_SERVICE_WORKER_CONTEXT_H_
OLDNEW
« no previous file with comments | « content/browser/service_worker/service_worker_context_wrapper.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698