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

Unified Diff: content/public/browser/service_worker_context.h

Issue 810583002: Teach CrOS's OfflineResourceThrottle about ServiceWorkers so it know longer presents its offline in… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/browser/service_worker/service_worker_request_handler.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/public/browser/service_worker_context.h
diff --git a/content/public/browser/service_worker_context.h b/content/public/browser/service_worker_context.h
index 94ab73f67e2d59d2a68035e03932f6f5b4b50b8c..22c989b4ce8254ddfd423421af59aec9cec2f69c 100644
--- a/content/public/browser/service_worker_context.h
+++ b/content/public/browser/service_worker_context.h
@@ -11,8 +11,13 @@
#include "base/basictypes.h"
#include "base/callback_forward.h"
#include "content/public/browser/service_worker_usage_info.h"
+#include "net/base/completion_callback.h"
#include "url/gurl.h"
+namespace net {
+class URLRequest;
+}
+
namespace content {
// Represents the per-StoragePartition ServiceWorker data.
@@ -36,6 +41,10 @@ class ServiceWorkerContext {
// Must be called from the IO thread.
static bool IsExcludedHeaderNameForFetchEvent(const std::string& header_name);
+ // Retrieves the ServiceWorkerContext, if any, associated with |request|.
+ CONTENT_EXPORT static ServiceWorkerContext* GetServiceWorkerContext(
+ net::URLRequest* request);
+
// Equivalent to calling navigator.serviceWorker.register(script_url, {scope:
// pattern}) from a renderer, except that |pattern| is an absolute URL instead
// of relative to some current origin. |callback| is passed true when the JS
@@ -64,6 +73,13 @@ class ServiceWorkerContext {
// TODO(jyasskin): Provide a way to SendMessage to a Scope.
+ // Determines if a request for 'url' can be satisfied while offline.
+ // This method always completes asynchronously.
+ virtual void CanHandleMainResourceOffline(const GURL& url,
+ const GURL& first_party,
+ const net::CompletionCallback&
+ callback) = 0;
+
// Methods used in response to browsing data and quota manager requests.
virtual void GetAllOriginsInfo(const GetUsageInfoCallback& callback) = 0;
virtual void DeleteForOrigin(const GURL& origin_url) = 0;
« no previous file with comments | « content/browser/service_worker/service_worker_request_handler.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698