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

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

Issue 483613004: [ServiceWorker] Support other methods than GET and HEAD. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 4 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <string> 7 #include <string>
8 8
9 #include "content/browser/service_worker/service_worker_context_core.h" 9 #include "content/browser/service_worker/service_worker_context_core.h"
10 #include "content/browser/service_worker/service_worker_context_wrapper.h" 10 #include "content/browser/service_worker/service_worker_context_wrapper.h"
(...skipping 24 matching lines...) Expand all
35 ServiceWorkerRequestHandler::GetHandler(request); 35 ServiceWorkerRequestHandler::GetHandler(request);
36 if (!handler) 36 if (!handler)
37 return NULL; 37 return NULL;
38 return handler->MaybeCreateJob(request, network_delegate); 38 return handler->MaybeCreateJob(request, network_delegate);
39 } 39 }
40 40
41 private: 41 private:
42 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerRequestInterceptor); 42 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerRequestInterceptor);
43 }; 43 };
44 44
45 bool IsMethodSupportedForAppCache(const std::string& method) {
46 return (method == "GET") || (method == "HEAD");
47 }
48
49 bool IsSchemeAndMethodSupportedForAppCache(const net::URLRequest* request) {
50 return request->url().SchemeIsHTTPOrHTTPS() &&
51 IsMethodSupportedForAppCache(request->method());
52 }
53
54 } // namespace 45 } // namespace
55 46
56 void ServiceWorkerRequestHandler::InitializeHandler( 47 void ServiceWorkerRequestHandler::InitializeHandler(
57 net::URLRequest* request, 48 net::URLRequest* request,
58 ServiceWorkerContextWrapper* context_wrapper, 49 ServiceWorkerContextWrapper* context_wrapper,
59 webkit_blob::BlobStorageContext* blob_storage_context, 50 webkit_blob::BlobStorageContext* blob_storage_context,
60 int process_id, 51 int process_id,
61 int provider_id, 52 int provider_id,
62 ResourceType resource_type) { 53 ResourceType resource_type) {
63 if (!IsSchemeAndMethodSupportedForAppCache(request)) { 54 if (!request->url().SchemeIsHTTPOrHTTPS())
falken 2014/08/18 06:31:46 I was confused by this AppCache name. It was proba
horo 2014/08/18 06:49:44 I think ServiceWorkerRequestHandler was initially
64 return; 55 return;
65 }
66 56
67 if (!context_wrapper || !context_wrapper->context() || 57 if (!context_wrapper || !context_wrapper->context() ||
68 provider_id == kInvalidServiceWorkerProviderId) { 58 provider_id == kInvalidServiceWorkerProviderId) {
69 return; 59 return;
70 } 60 }
71 61
72 ServiceWorkerProviderHost* provider_host = 62 ServiceWorkerProviderHost* provider_host =
73 context_wrapper->context()->GetProviderHost(process_id, provider_id); 63 context_wrapper->context()->GetProviderHost(process_id, provider_id);
74 if (!provider_host || !provider_host->IsContextAlive()) 64 if (!provider_host || !provider_host->IsContextAlive())
75 return; 65 return;
(...skipping 27 matching lines...) Expand all
103 base::WeakPtr<ServiceWorkerProviderHost> provider_host, 93 base::WeakPtr<ServiceWorkerProviderHost> provider_host,
104 base::WeakPtr<webkit_blob::BlobStorageContext> blob_storage_context, 94 base::WeakPtr<webkit_blob::BlobStorageContext> blob_storage_context,
105 ResourceType resource_type) 95 ResourceType resource_type)
106 : context_(context), 96 : context_(context),
107 provider_host_(provider_host), 97 provider_host_(provider_host),
108 blob_storage_context_(blob_storage_context), 98 blob_storage_context_(blob_storage_context),
109 resource_type_(resource_type) { 99 resource_type_(resource_type) {
110 } 100 }
111 101
112 } // namespace content 102 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698