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

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

Issue 282103004: Rename ProtocolInterceptJobFactory and make it not use ProtocolHandlers. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Response to jam's comments (And a merge) Created 6 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 | Annotate | Revision Log
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 #include "content/browser/service_worker/service_worker_request_handler.h" 5 #include "content/browser/service_worker/service_worker_request_handler.h"
6 6
7 #include "content/browser/service_worker/service_worker_context_core.h" 7 #include "content/browser/service_worker/service_worker_context_core.h"
8 #include "content/browser/service_worker/service_worker_context_wrapper.h" 8 #include "content/browser/service_worker/service_worker_context_wrapper.h"
9 #include "content/browser/service_worker/service_worker_provider_host.h" 9 #include "content/browser/service_worker/service_worker_provider_host.h"
10 #include "content/browser/service_worker/service_worker_registration.h" 10 #include "content/browser/service_worker/service_worker_registration.h"
11 #include "content/browser/service_worker/service_worker_url_request_job.h" 11 #include "content/browser/service_worker/service_worker_url_request_job.h"
12 #include "content/browser/service_worker/service_worker_utils.h" 12 #include "content/browser/service_worker/service_worker_utils.h"
13 #include "content/common/service_worker/service_worker_types.h" 13 #include "content/common/service_worker/service_worker_types.h"
14 #include "net/url_request/url_request.h" 14 #include "net/url_request/url_request.h"
15 #include "net/url_request/url_request_interceptor.h"
15 #include "webkit/browser/blob/blob_storage_context.h" 16 #include "webkit/browser/blob/blob_storage_context.h"
16 17
17 namespace content { 18 namespace content {
18 19
19 namespace { 20 namespace {
20 21
21 int kUserDataKey; // Key value is not important. 22 int kUserDataKey; // Key value is not important.
22 23
23 class ServiceWorkerRequestInterceptor 24 class ServiceWorkerRequestInterceptor
24 : public net::URLRequestJobFactory::ProtocolHandler { 25 : public net::URLRequestInterceptor {
25 public: 26 public:
26 ServiceWorkerRequestInterceptor() {} 27 ServiceWorkerRequestInterceptor() {}
27 virtual ~ServiceWorkerRequestInterceptor() {} 28 virtual ~ServiceWorkerRequestInterceptor() {}
28 virtual net::URLRequestJob* MaybeCreateJob( 29 virtual net::URLRequestJob* MaybeInterceptRequest(
29 net::URLRequest* request, 30 net::URLRequest* request,
30 net::NetworkDelegate* network_delegate) const OVERRIDE { 31 net::NetworkDelegate* network_delegate) const OVERRIDE {
31 ServiceWorkerRequestHandler* handler = 32 ServiceWorkerRequestHandler* handler =
32 ServiceWorkerRequestHandler::GetHandler(request); 33 ServiceWorkerRequestHandler::GetHandler(request);
33 if (!handler) 34 if (!handler)
34 return NULL; 35 return NULL;
35 return handler->MaybeCreateJob(request, network_delegate); 36 return handler->MaybeCreateJob(request, network_delegate);
36 } 37 }
37 38
38 private: 39 private:
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 81
81 request->SetUserData(&kUserDataKey, handler.release()); 82 request->SetUserData(&kUserDataKey, handler.release());
82 } 83 }
83 84
84 ServiceWorkerRequestHandler* ServiceWorkerRequestHandler::GetHandler( 85 ServiceWorkerRequestHandler* ServiceWorkerRequestHandler::GetHandler(
85 net::URLRequest* request) { 86 net::URLRequest* request) {
86 return reinterpret_cast<ServiceWorkerRequestHandler*>( 87 return reinterpret_cast<ServiceWorkerRequestHandler*>(
87 request->GetUserData(&kUserDataKey)); 88 request->GetUserData(&kUserDataKey));
88 } 89 }
89 90
90 scoped_ptr<net::URLRequestJobFactory::ProtocolHandler> 91 scoped_ptr<net::URLRequestInterceptor>
91 ServiceWorkerRequestHandler::CreateInterceptor() { 92 ServiceWorkerRequestHandler::CreateInterceptor() {
92 return make_scoped_ptr<net::URLRequestJobFactory::ProtocolHandler>( 93 return scoped_ptr<net::URLRequestInterceptor>(
93 new ServiceWorkerRequestInterceptor); 94 new ServiceWorkerRequestInterceptor);
94 } 95 }
95 96
96 ServiceWorkerRequestHandler::~ServiceWorkerRequestHandler() { 97 ServiceWorkerRequestHandler::~ServiceWorkerRequestHandler() {
97 } 98 }
98 99
99 ServiceWorkerRequestHandler::ServiceWorkerRequestHandler( 100 ServiceWorkerRequestHandler::ServiceWorkerRequestHandler(
100 base::WeakPtr<ServiceWorkerContextCore> context, 101 base::WeakPtr<ServiceWorkerContextCore> context,
101 base::WeakPtr<ServiceWorkerProviderHost> provider_host, 102 base::WeakPtr<ServiceWorkerProviderHost> provider_host,
102 base::WeakPtr<webkit_blob::BlobStorageContext> blob_storage_context, 103 base::WeakPtr<webkit_blob::BlobStorageContext> blob_storage_context,
103 ResourceType::Type resource_type) 104 ResourceType::Type resource_type)
104 : context_(context), 105 : context_(context),
105 provider_host_(provider_host), 106 provider_host_(provider_host),
106 blob_storage_context_(blob_storage_context), 107 blob_storage_context_(blob_storage_context),
107 resource_type_(resource_type) { 108 resource_type_(resource_type) {
108 } 109 }
109 110
110 } // namespace content 111 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/service_worker/service_worker_request_handler.h ('k') | content/browser/storage_partition_impl_map.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698