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

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

Issue 1914593002: Limit requests for which link headers can install service workers to secure contexts. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address comments Created 4 years, 5 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 <memory> 8 #include <memory>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 FetchCredentialsMode credentials_mode, 74 FetchCredentialsMode credentials_mode,
75 FetchRedirectMode redirect_mode, 75 FetchRedirectMode redirect_mode,
76 ResourceType resource_type, 76 ResourceType resource_type,
77 RequestContextType request_context_type, 77 RequestContextType request_context_type,
78 RequestContextFrameType frame_type, 78 RequestContextFrameType frame_type,
79 scoped_refptr<ResourceRequestBodyImpl> body); 79 scoped_refptr<ResourceRequestBodyImpl> body);
80 80
81 // Returns the handler attached to |request|. This may return NULL 81 // Returns the handler attached to |request|. This may return NULL
82 // if no handler is attached. 82 // if no handler is attached.
83 static ServiceWorkerRequestHandler* GetHandler( 83 static ServiceWorkerRequestHandler* GetHandler(
84 net::URLRequest* request); 84 const net::URLRequest* request);
85 85
86 // Creates a protocol interceptor for ServiceWorker. 86 // Creates a protocol interceptor for ServiceWorker.
87 static std::unique_ptr<net::URLRequestInterceptor> CreateInterceptor( 87 static std::unique_ptr<net::URLRequestInterceptor> CreateInterceptor(
88 ResourceContext* resource_context); 88 ResourceContext* resource_context);
89 89
90 // Returns true if the request falls into the scope of a ServiceWorker. 90 // Returns true if the request falls into the scope of a ServiceWorker.
91 // It's only reliable after the ServiceWorkerRequestHandler MaybeCreateJob 91 // It's only reliable after the ServiceWorkerRequestHandler MaybeCreateJob
92 // method runs to completion for this request. The AppCache handler uses 92 // method runs to completion for this request. The AppCache handler uses
93 // this to avoid colliding with ServiceWorkers. 93 // this to avoid colliding with ServiceWorkers.
94 static bool IsControlledByServiceWorker(net::URLRequest* request); 94 static bool IsControlledByServiceWorker(const net::URLRequest* request);
95
96 // Returns the ServiceWorkerProviderHost the request is associated with.
97 // Only valid after InitializeHandler has been called. Can return null.
98 static ServiceWorkerProviderHost* GetProviderHost(
99 const net::URLRequest* request);
95 100
96 ~ServiceWorkerRequestHandler() override; 101 ~ServiceWorkerRequestHandler() override;
97 102
98 // Called via custom URLRequestJobFactory. 103 // Called via custom URLRequestJobFactory.
99 virtual net::URLRequestJob* MaybeCreateJob( 104 virtual net::URLRequestJob* MaybeCreateJob(
100 net::URLRequest* request, 105 net::URLRequest* request,
101 net::NetworkDelegate* network_delegate, 106 net::NetworkDelegate* network_delegate,
102 ResourceContext* context) = 0; 107 ResourceContext* context) = 0;
103 108
104 // Methods to support cross site navigations. 109 // Methods to support cross site navigations.
(...skipping 23 matching lines...) Expand all
128 std::unique_ptr<ServiceWorkerProviderHost> host_for_cross_site_transfer_; 133 std::unique_ptr<ServiceWorkerProviderHost> host_for_cross_site_transfer_;
129 int old_process_id_; 134 int old_process_id_;
130 int old_provider_id_; 135 int old_provider_id_;
131 136
132 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerRequestHandler); 137 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerRequestHandler);
133 }; 138 };
134 139
135 } // namespace content 140 } // namespace content
136 141
137 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_REQUEST_HANDLER_H_ 142 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_REQUEST_HANDLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698