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 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
62 | 62 |
63 // Returns the handler attached to |request|. This may return NULL | 63 // Returns the handler attached to |request|. This may return NULL |
64 // if no handler is attached. | 64 // if no handler is attached. |
65 static ServiceWorkerRequestHandler* GetHandler( | 65 static ServiceWorkerRequestHandler* GetHandler( |
66 net::URLRequest* request); | 66 net::URLRequest* request); |
67 | 67 |
68 // Creates a protocol interceptor for ServiceWorker. | 68 // Creates a protocol interceptor for ServiceWorker. |
69 static scoped_ptr<net::URLRequestInterceptor> CreateInterceptor( | 69 static scoped_ptr<net::URLRequestInterceptor> CreateInterceptor( |
70 ResourceContext* resource_context); | 70 ResourceContext* resource_context); |
71 | 71 |
| 72 // Returns true if the request falls into the scope of a ServiceWorker. |
| 73 // It's only reliable after the ServiceWorkerRequestHandler MaybeCreateJob |
| 74 // method runs to completion for this request. The AppCache handler uses |
| 75 // this to avoid colliding with ServiceWorkers. |
| 76 static bool IsControlledByServiceWorker(net::URLRequest* request); |
| 77 |
72 virtual ~ServiceWorkerRequestHandler(); | 78 virtual ~ServiceWorkerRequestHandler(); |
73 | 79 |
74 // Called via custom URLRequestJobFactory. | 80 // Called via custom URLRequestJobFactory. |
75 virtual net::URLRequestJob* MaybeCreateJob( | 81 virtual net::URLRequestJob* MaybeCreateJob( |
76 net::URLRequest* request, | 82 net::URLRequest* request, |
77 net::NetworkDelegate* network_delegate, | 83 net::NetworkDelegate* network_delegate, |
78 ResourceContext* context) = 0; | 84 ResourceContext* context) = 0; |
79 | 85 |
80 virtual void GetExtraResponseInfo( | 86 virtual void GetExtraResponseInfo( |
81 bool* was_fetched_via_service_worker, | 87 bool* was_fetched_via_service_worker, |
(...skipping 15 matching lines...) Expand all Loading... |
97 base::WeakPtr<storage::BlobStorageContext> blob_storage_context_; | 103 base::WeakPtr<storage::BlobStorageContext> blob_storage_context_; |
98 ResourceType resource_type_; | 104 ResourceType resource_type_; |
99 | 105 |
100 private: | 106 private: |
101 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerRequestHandler); | 107 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerRequestHandler); |
102 }; | 108 }; |
103 | 109 |
104 } // namespace content | 110 } // namespace content |
105 | 111 |
106 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_REQUEST_HANDLER_H_ | 112 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_REQUEST_HANDLER_H_ |
OLD | NEW |