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 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 scoped_refptr<ResourceRequestBody> body); | 53 scoped_refptr<ResourceRequestBody> body); |
54 | 54 |
55 // Returns the handler attached to |request|. This may return NULL | 55 // Returns the handler attached to |request|. This may return NULL |
56 // if no handler is attached. | 56 // if no handler is attached. |
57 static ServiceWorkerRequestHandler* GetHandler( | 57 static ServiceWorkerRequestHandler* GetHandler( |
58 net::URLRequest* request); | 58 net::URLRequest* request); |
59 | 59 |
60 // Creates a protocol interceptor for ServiceWorker. | 60 // Creates a protocol interceptor for ServiceWorker. |
61 static scoped_ptr<net::URLRequestInterceptor> CreateInterceptor(); | 61 static scoped_ptr<net::URLRequestInterceptor> CreateInterceptor(); |
62 | 62 |
| 63 // Returns true if the request falls into the scope of a ServiceWorker. |
| 64 // It's only reliable after the ServiceWorkerRequestHandler MaybeCreateJob |
| 65 // method run to completion for this request. The AppCache handler uses |
| 66 // this to avoid colliding with ServiceWorkers. |
| 67 static bool IsControlledByServiceWorker(net::URLRequest* request); |
| 68 |
63 virtual ~ServiceWorkerRequestHandler(); | 69 virtual ~ServiceWorkerRequestHandler(); |
64 | 70 |
65 // Called via custom URLRequestJobFactory. | 71 // Called via custom URLRequestJobFactory. |
66 virtual net::URLRequestJob* MaybeCreateJob( | 72 virtual net::URLRequestJob* MaybeCreateJob( |
67 net::URLRequest* request, | 73 net::URLRequest* request, |
68 net::NetworkDelegate* network_delegate) = 0; | 74 net::NetworkDelegate* network_delegate) = 0; |
69 | 75 |
70 virtual void GetExtraResponseInfo( | 76 virtual void GetExtraResponseInfo( |
71 bool* was_fetched_via_service_worker, | 77 bool* was_fetched_via_service_worker, |
72 GURL* original_url_via_service_worker, | 78 GURL* original_url_via_service_worker, |
(...skipping 13 matching lines...) Expand all Loading... |
86 base::WeakPtr<storage::BlobStorageContext> blob_storage_context_; | 92 base::WeakPtr<storage::BlobStorageContext> blob_storage_context_; |
87 ResourceType resource_type_; | 93 ResourceType resource_type_; |
88 | 94 |
89 private: | 95 private: |
90 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerRequestHandler); | 96 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerRequestHandler); |
91 }; | 97 }; |
92 | 98 |
93 } // namespace content | 99 } // namespace content |
94 | 100 |
95 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_REQUEST_HANDLER_H_ | 101 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_REQUEST_HANDLER_H_ |
OLD | NEW |