OLD | NEW |
---|---|
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_BROWSER_SERVICE_WORKER_SERVICE_WORKER_REQUEST_HANDLER_H_ | 5 #ifndef CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_REQUEST_HANDLER_H_ |
6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_REQUEST_HANDLER_H_ | 6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_REQUEST_HANDLER_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/memory/weak_ptr.h" | 9 #include "base/memory/weak_ptr.h" |
10 #include "base/supports_user_data.h" | 10 #include "base/supports_user_data.h" |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
60 scoped_refptr<ResourceRequestBody> body); | 60 scoped_refptr<ResourceRequestBody> body); |
61 | 61 |
62 // Returns the handler attached to |request|. This may return NULL | 62 // Returns the handler attached to |request|. This may return NULL |
63 // if no handler is attached. | 63 // if no handler is attached. |
64 static ServiceWorkerRequestHandler* GetHandler( | 64 static ServiceWorkerRequestHandler* GetHandler( |
65 net::URLRequest* request); | 65 net::URLRequest* request); |
66 | 66 |
67 // Creates a protocol interceptor for ServiceWorker. | 67 // Creates a protocol interceptor for ServiceWorker. |
68 static scoped_ptr<net::URLRequestInterceptor> CreateInterceptor(); | 68 static scoped_ptr<net::URLRequestInterceptor> CreateInterceptor(); |
69 | 69 |
70 // Returns true if the request falls into the scope of a ServiceWorker. | |
71 // It's only reliable after the ServiceWorkerRequestHandler MaybeCreateJob | |
72 // method run to completion for this request. The AppCache handler uses | |
falken
2014/10/14 01:24:49
nit: runs
| |
73 // this to avoid colliding with ServiceWorkers. | |
74 static bool IsControlledByServiceWorker(net::URLRequest* request); | |
75 | |
70 virtual ~ServiceWorkerRequestHandler(); | 76 virtual ~ServiceWorkerRequestHandler(); |
71 | 77 |
72 // Called via custom URLRequestJobFactory. | 78 // Called via custom URLRequestJobFactory. |
73 virtual net::URLRequestJob* MaybeCreateJob( | 79 virtual net::URLRequestJob* MaybeCreateJob( |
74 net::URLRequest* request, | 80 net::URLRequest* request, |
75 net::NetworkDelegate* network_delegate) = 0; | 81 net::NetworkDelegate* network_delegate) = 0; |
76 | 82 |
77 virtual void GetExtraResponseInfo( | 83 virtual void GetExtraResponseInfo( |
78 bool* was_fetched_via_service_worker, | 84 bool* was_fetched_via_service_worker, |
79 bool* was_fallback_required_by_service_worker, | 85 bool* was_fallback_required_by_service_worker, |
(...skipping 14 matching lines...) Expand all Loading... | |
94 base::WeakPtr<storage::BlobStorageContext> blob_storage_context_; | 100 base::WeakPtr<storage::BlobStorageContext> blob_storage_context_; |
95 ResourceType resource_type_; | 101 ResourceType resource_type_; |
96 | 102 |
97 private: | 103 private: |
98 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerRequestHandler); | 104 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerRequestHandler); |
99 }; | 105 }; |
100 | 106 |
101 } // namespace content | 107 } // namespace content |
102 | 108 |
103 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_REQUEST_HANDLER_H_ | 109 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_REQUEST_HANDLER_H_ |
OLD | NEW |