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

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

Issue 492873002: Collapse fileapi, webkit_blob, webkit_database, quota, and webkit_common namespaces into single sto… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix chromeos build 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 | 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 #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 "content/common/content_export.h" 11 #include "content/common/content_export.h"
12 #include "content/common/service_worker/service_worker_status_code.h" 12 #include "content/common/service_worker/service_worker_status_code.h"
13 #include "content/public/common/resource_type.h" 13 #include "content/public/common/resource_type.h"
14 #include "net/url_request/url_request_job_factory.h" 14 #include "net/url_request/url_request_job_factory.h"
15 15
16 namespace net { 16 namespace net {
17 class NetworkDelegate; 17 class NetworkDelegate;
18 class URLRequest; 18 class URLRequest;
19 class URLRequestInterceptor; 19 class URLRequestInterceptor;
20 } 20 }
21 21
22 namespace webkit_blob { 22 namespace storage {
23 class BlobStorageContext; 23 class BlobStorageContext;
24 } 24 }
25 25
26 namespace content { 26 namespace content {
27 27
28 class ResourceRequestBody; 28 class ResourceRequestBody;
29 class ServiceWorkerContextCore; 29 class ServiceWorkerContextCore;
30 class ServiceWorkerContextWrapper; 30 class ServiceWorkerContextWrapper;
31 class ServiceWorkerProviderHost; 31 class ServiceWorkerProviderHost;
32 32
33 // Abstract base class for routing network requests to ServiceWorkers. 33 // Abstract base class for routing network requests to ServiceWorkers.
34 // Created one per URLRequest and attached to each request. 34 // Created one per URLRequest and attached to each request.
35 class CONTENT_EXPORT ServiceWorkerRequestHandler 35 class CONTENT_EXPORT ServiceWorkerRequestHandler
36 : public base::SupportsUserData::Data { 36 : public base::SupportsUserData::Data {
37 public: 37 public:
38 // Attaches a newly created handler if the given |request| needs to 38 // Attaches a newly created handler if the given |request| needs to
39 // be handled by ServiceWorker. 39 // be handled by ServiceWorker.
40 // TODO(kinuko): While utilizing UserData to attach data to URLRequest 40 // TODO(kinuko): While utilizing UserData to attach data to URLRequest
41 // has some precedence, it might be better to attach this handler in a more 41 // has some precedence, it might be better to attach this handler in a more
42 // explicit way within content layer, e.g. have ResourceRequestInfoImpl 42 // explicit way within content layer, e.g. have ResourceRequestInfoImpl
43 // own it. 43 // own it.
44 static void InitializeHandler( 44 static void InitializeHandler(
45 net::URLRequest* request, 45 net::URLRequest* request,
46 ServiceWorkerContextWrapper* context_wrapper, 46 ServiceWorkerContextWrapper* context_wrapper,
47 webkit_blob::BlobStorageContext* blob_storage_context, 47 storage::BlobStorageContext* blob_storage_context,
48 int process_id, 48 int process_id,
49 int provider_id, 49 int provider_id,
50 ResourceType resource_type, 50 ResourceType resource_type,
51 scoped_refptr<ResourceRequestBody> body); 51 scoped_refptr<ResourceRequestBody> body);
52 52
53 // Returns the handler attached to |request|. This may return NULL 53 // Returns the handler attached to |request|. This may return NULL
54 // if no handler is attached. 54 // if no handler is attached.
55 static ServiceWorkerRequestHandler* GetHandler( 55 static ServiceWorkerRequestHandler* GetHandler(
56 net::URLRequest* request); 56 net::URLRequest* request);
57 57
58 // Creates a protocol interceptor for ServiceWorker. 58 // Creates a protocol interceptor for ServiceWorker.
59 static scoped_ptr<net::URLRequestInterceptor> CreateInterceptor(); 59 static scoped_ptr<net::URLRequestInterceptor> CreateInterceptor();
60 60
61 virtual ~ServiceWorkerRequestHandler(); 61 virtual ~ServiceWorkerRequestHandler();
62 62
63 // Called via custom URLRequestJobFactory. 63 // Called via custom URLRequestJobFactory.
64 virtual net::URLRequestJob* MaybeCreateJob( 64 virtual net::URLRequestJob* MaybeCreateJob(
65 net::URLRequest* request, 65 net::URLRequest* request,
66 net::NetworkDelegate* network_delegate) = 0; 66 net::NetworkDelegate* network_delegate) = 0;
67 67
68 virtual void GetExtraResponseInfo( 68 virtual void GetExtraResponseInfo(
69 bool* was_fetched_via_service_worker, 69 bool* was_fetched_via_service_worker,
70 GURL* original_url_via_service_worker) const = 0; 70 GURL* original_url_via_service_worker) const = 0;
71 71
72 protected: 72 protected:
73 ServiceWorkerRequestHandler( 73 ServiceWorkerRequestHandler(
74 base::WeakPtr<ServiceWorkerContextCore> context, 74 base::WeakPtr<ServiceWorkerContextCore> context,
75 base::WeakPtr<ServiceWorkerProviderHost> provider_host, 75 base::WeakPtr<ServiceWorkerProviderHost> provider_host,
76 base::WeakPtr<webkit_blob::BlobStorageContext> blob_storage_context, 76 base::WeakPtr<storage::BlobStorageContext> blob_storage_context,
77 ResourceType resource_type); 77 ResourceType resource_type);
78 78
79 base::WeakPtr<ServiceWorkerContextCore> context_; 79 base::WeakPtr<ServiceWorkerContextCore> context_;
80 base::WeakPtr<ServiceWorkerProviderHost> provider_host_; 80 base::WeakPtr<ServiceWorkerProviderHost> provider_host_;
81 base::WeakPtr<webkit_blob::BlobStorageContext> blob_storage_context_; 81 base::WeakPtr<storage::BlobStorageContext> blob_storage_context_;
82 ResourceType resource_type_; 82 ResourceType resource_type_;
83 83
84 private: 84 private:
85 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerRequestHandler); 85 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerRequestHandler);
86 }; 86 };
87 87
88 } // namespace content 88 } // namespace content
89 89
90 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_REQUEST_HANDLER_H_ 90 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_REQUEST_HANDLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698