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

Unified 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, 8 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/service_worker/service_worker_controllee_request_handler.h
diff --git a/content/browser/service_worker/service_worker_controllee_request_handler.h b/content/browser/service_worker/service_worker_controllee_request_handler.h
new file mode 100644
index 0000000000000000000000000000000000000000..4a12fd8610626f909b876c8357168642e235b158
--- /dev/null
+++ b/content/browser/service_worker/service_worker_controllee_request_handler.h
@@ -0,0 +1,56 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_CONTROLLEE_REQUEST_HANDLER_H_
+#define CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_CONTROLLEE_REQUEST_HANDLER_H_
+
+#include "content/browser/service_worker/service_worker_request_handler.h"
+
+namespace net {
+class NetworkDelegate;
+class URLRequest;
+}
+
+namespace content {
+
+class ServiceWorkerRegistration;
+class ServiceWorkerURLRequestJob;
+
+// A request handler derivative used to handle requests from
+// controlled documents.
+class CONTENT_EXPORT ServiceWorkerControlleeRequestHandler
+ : public ServiceWorkerRequestHandler {
+ public:
+ ServiceWorkerControlleeRequestHandler(
+ base::WeakPtr<ServiceWorkerContextCore> context,
+ base::WeakPtr<ServiceWorkerProviderHost> provider_host,
+ ResourceType::Type resource_type);
+ virtual ~ServiceWorkerControlleeRequestHandler();
+
+ // Called via custom URLRequestJobFactory.
+ virtual net::URLRequestJob* MaybeCreateJob(
+ net::URLRequest* request,
+ net::NetworkDelegate* network_delegate) OVERRIDE;
+
+ private:
+ typedef ServiceWorkerControlleeRequestHandler self;
+
+ // For main resource case.
+ void PrepareForMainResource(const GURL& url);
+ void DidLookupRegistrationForMainResource(
+ ServiceWorkerStatusCode status,
+ const scoped_refptr<ServiceWorkerRegistration>& registration);
+
+ // For sub resource case.
+ void PrepareForSubResource();
+
+ scoped_refptr<ServiceWorkerURLRequestJob> job_;
+ base::WeakPtrFactory<ServiceWorkerControlleeRequestHandler> weak_factory_;
+
+ DISALLOW_COPY_AND_ASSIGN(ServiceWorkerControlleeRequestHandler);
+};
+
+} // namespace content
+
+#endif // CONTENT_BROWSER_SERVICE_WORKER_SERVICE_WORKER_CONTROLLEE_REQUEST_HANDLER_H_

Powered by Google App Engine
This is Rietveld 408576698