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

Side by Side Diff: content/browser/service_worker/service_worker_request_handler.h

Issue 1146253004: Add workerReady timing for ServiceWorker controlled requests [2/3] (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 6 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
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_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"
11 #include "base/time/time.h" 11 #include "base/time/time.h"
12 #include "content/common/content_export.h" 12 #include "content/common/content_export.h"
13 #include "content/common/service_worker/service_worker_status_code.h" 13 #include "content/common/service_worker/service_worker_status_code.h"
14 #include "content/common/service_worker/service_worker_types.h" 14 #include "content/common/service_worker/service_worker_types.h"
15 #include "content/public/common/request_context_frame_type.h" 15 #include "content/public/common/request_context_frame_type.h"
16 #include "content/public/common/request_context_type.h" 16 #include "content/public/common/request_context_type.h"
17 #include "content/public/common/resource_type.h" 17 #include "content/public/common/resource_type.h"
18 #include "net/url_request/url_request_job_factory.h" 18 #include "net/url_request/url_request_job_factory.h"
19 #include "third_party/WebKit/public/platform/WebServiceWorkerResponseType.h"
20 19
21 namespace net { 20 namespace net {
22 class NetworkDelegate; 21 class NetworkDelegate;
23 class URLRequest; 22 class URLRequest;
24 class URLRequestInterceptor; 23 class URLRequestInterceptor;
25 } 24 }
26 25
27 namespace storage { 26 namespace storage {
28 class BlobStorageContext; 27 class BlobStorageContext;
29 } 28 }
30 29
31 namespace content { 30 namespace content {
32 31
33 class ResourceContext; 32 class ResourceContext;
34 class ResourceRequestBody; 33 class ResourceRequestBody;
35 class ServiceWorkerContextCore; 34 class ServiceWorkerContextCore;
36 class ServiceWorkerContextWrapper; 35 class ServiceWorkerContextWrapper;
37 class ServiceWorkerProviderHost; 36 class ServiceWorkerProviderHost;
37 struct ResourceResponseInfo;
38 38
39 // Abstract base class for routing network requests to ServiceWorkers. 39 // Abstract base class for routing network requests to ServiceWorkers.
40 // Created one per URLRequest and attached to each request. 40 // Created one per URLRequest and attached to each request.
41 class CONTENT_EXPORT ServiceWorkerRequestHandler 41 class CONTENT_EXPORT ServiceWorkerRequestHandler
42 : public base::SupportsUserData::Data { 42 : public base::SupportsUserData::Data {
43 public: 43 public:
44 // Attaches a newly created handler if the given |request| needs to 44 // Attaches a newly created handler if the given |request| needs to
45 // be handled by ServiceWorker. 45 // be handled by ServiceWorker.
46 // TODO(kinuko): While utilizing UserData to attach data to URLRequest 46 // TODO(kinuko): While utilizing UserData to attach data to URLRequest
47 // has some precedence, it might be better to attach this handler in a more 47 // has some precedence, it might be better to attach this handler in a more
(...skipping 30 matching lines...) Expand all
78 78
79 ~ServiceWorkerRequestHandler() override; 79 ~ServiceWorkerRequestHandler() override;
80 80
81 // Called via custom URLRequestJobFactory. 81 // Called via custom URLRequestJobFactory.
82 virtual net::URLRequestJob* MaybeCreateJob( 82 virtual net::URLRequestJob* MaybeCreateJob(
83 net::URLRequest* request, 83 net::URLRequest* request,
84 net::NetworkDelegate* network_delegate, 84 net::NetworkDelegate* network_delegate,
85 ResourceContext* context) = 0; 85 ResourceContext* context) = 0;
86 86
87 virtual void GetExtraResponseInfo( 87 virtual void GetExtraResponseInfo(
88 bool* was_fetched_via_service_worker, 88 ResourceResponseInfo* response_info) const = 0;
89 bool* was_fallback_required_by_service_worker,
90 GURL* original_url_via_service_worker,
91 blink::WebServiceWorkerResponseType* response_type_via_service_worker,
92 base::TimeTicks* worker_start_time) const = 0;
93 89
94 // Methods to support cross site navigations. 90 // Methods to support cross site navigations.
95 void PrepareForCrossSiteTransfer(int old_process_id); 91 void PrepareForCrossSiteTransfer(int old_process_id);
96 void CompleteCrossSiteTransfer(int new_process_id, 92 void CompleteCrossSiteTransfer(int new_process_id,
97 int new_provider_id); 93 int new_provider_id);
98 void MaybeCompleteCrossSiteTransferInOldProcess( 94 void MaybeCompleteCrossSiteTransferInOldProcess(
99 int old_process_id); 95 int old_process_id);
100 96
101 ServiceWorkerContextCore* context() const { return context_.get(); } 97 ServiceWorkerContextCore* context() const { return context_.get(); }
102 98
(...skipping 13 matching lines...) Expand all
116 scoped_ptr<ServiceWorkerProviderHost> host_for_cross_site_transfer_; 112 scoped_ptr<ServiceWorkerProviderHost> host_for_cross_site_transfer_;
117 int old_process_id_; 113 int old_process_id_;
118 int old_provider_id_; 114 int old_provider_id_;
119 115
120 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerRequestHandler); 116 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerRequestHandler);
121 }; 117 };
122 118
123 } // namespace content 119 } // namespace content
124 120
125 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_REQUEST_HANDLER_H_ 121 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_REQUEST_HANDLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698