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

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

Issue 255413005: Mostly manual refactoring of ServiceWorkerRequestHandler into a base class and two derived classes,… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_CONTROLLEE_REQUEST_HANDLER _H_
6 #define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_CONTROLLEE_REQUEST_HANDLER _H_
7
8 #include "content/browser/service_worker/service_worker_request_handler.h"
9
10 namespace net {
11 class NetworkDelegate;
12 class URLRequest;
13 }
14
15 namespace content {
16
17 class ServiceWorkerRegistration;
18 class ServiceWorkerURLRequestJob;
19
20 // A request handler derivative used to handle requests from
21 // controlled documents.
22 class CONTENT_EXPORT ServiceWorkerControlleeRequestHandler
23 : public ServiceWorkerRequestHandler {
24 public:
25 ServiceWorkerControlleeRequestHandler(
26 base::WeakPtr<ServiceWorkerContextCore> context,
27 base::WeakPtr<ServiceWorkerProviderHost> provider_host,
28 ResourceType::Type resource_type);
29 virtual ~ServiceWorkerControlleeRequestHandler();
30
31 // Called via custom URLRequestJobFactory.
32 virtual net::URLRequestJob* MaybeCreateJob(
33 net::URLRequest* request,
34 net::NetworkDelegate* network_delegate) OVERRIDE;
35
36 private:
37 typedef ServiceWorkerControlleeRequestHandler self;
38
39 // For main resource case.
40 void PrepareForMainResource(const GURL& url);
41 void DidLookupRegistrationForMainResource(
42 ServiceWorkerStatusCode status,
43 const scoped_refptr<ServiceWorkerRegistration>& registration);
44
45 // For sub resource case.
46 void PrepareForSubResource();
47
48 scoped_refptr<ServiceWorkerURLRequestJob> job_;
49 base::WeakPtrFactory<ServiceWorkerControlleeRequestHandler> weak_factory_;
50
51 DISALLOW_COPY_AND_ASSIGN(ServiceWorkerControlleeRequestHandler);
52 };
53
54 } // namespace content
55
56 #endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_CONTROLLEE_REQUEST_HAND LER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698