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

Side by Side Diff: content/browser/loader/navigation_url_loader_impl_core.h

Issue 2045383002: PlzNavigate: detect when a ServiceWorker is present (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Calling FindReadyRegistartionForDocument Created 4 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
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_LOADER_NAVIGATION_URL_LOADER_IMPL_CORE_H_ 5 #ifndef CONTENT_BROWSER_LOADER_NAVIGATION_URL_LOADER_IMPL_CORE_H_
6 #define CONTENT_BROWSER_LOADER_NAVIGATION_URL_LOADER_IMPL_CORE_H_ 6 #define CONTENT_BROWSER_LOADER_NAVIGATION_URL_LOADER_IMPL_CORE_H_
7 7
8 #include <memory> 8 #include <memory>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
11 #include "base/memory/weak_ptr.h" 11 #include "base/memory/weak_ptr.h"
12 #include "content/browser/loader/navigation_url_loader_impl.h" 12 #include "content/browser/loader/navigation_url_loader_impl.h"
13 #include "content/common/service_worker/service_worker_status_code.h"
13 14
14 namespace net { 15 namespace net {
15 class URLRequest; 16 class URLRequest;
16 struct RedirectInfo; 17 struct RedirectInfo;
17 } 18 }
18 19
19 namespace content { 20 namespace content {
20 21
21 class FrameTreeNode; 22 class FrameTreeNode;
22 class NavigationResourceHandler; 23 class NavigationResourceHandler;
23 class NavigationData; 24 class NavigationData;
24 class ResourceContext; 25 class ResourceContext;
25 class ResourceHandler; 26 class ResourceHandler;
26 class ResourceRequestBody; 27 class ResourceRequestBody;
27 class ServiceWorkerNavigationHandleCore; 28 class ServiceWorkerContextWrapper;
29 class ServiceWorkerRegistration;
28 class StreamHandle; 30 class StreamHandle;
29 struct ResourceResponse; 31 struct ResourceResponse;
30 32
31 // The IO-thread counterpart to the NavigationURLLoaderImpl. It lives on the IO 33 // The IO-thread counterpart to the NavigationURLLoaderImpl. It lives on the IO
32 // thread and is owned by the UI-thread NavigationURLLoaderImpl. 34 // thread and is owned by the UI-thread NavigationURLLoaderImpl.
33 // NavigationURLLoaderImplCore interacts with the ResourceDispatcherHost stack 35 // NavigationURLLoaderImplCore interacts with the ResourceDispatcherHost stack
34 // and forwards signals back to the loader on the UI thread. 36 // and forwards signals back to the loader on the UI thread.
35 class NavigationURLLoaderImplCore { 37 class NavigationURLLoaderImplCore {
36 public: 38 public:
37 // Creates a new NavigationURLLoaderImplCore that forwards signals back to 39 // Creates a new NavigationURLLoaderImplCore that forwards signals back to
38 // |loader| on the UI thread. 40 // |loader| on the UI thread.
39 explicit NavigationURLLoaderImplCore( 41 explicit NavigationURLLoaderImplCore(
40 const base::WeakPtr<NavigationURLLoaderImpl>& loader); 42 const base::WeakPtr<NavigationURLLoaderImpl>& loader);
41 ~NavigationURLLoaderImplCore(); 43 ~NavigationURLLoaderImplCore();
42 44
43 // Starts the request. 45 // Starts the request.
44 void Start(ResourceContext* resource_context, 46 void Start(ResourceContext* resource_context,
45 ServiceWorkerNavigationHandleCore* service_worker_handle_core, 47 ServiceWorkerContextWrapper* service_worker_context_wrapper,
46 std::unique_ptr<NavigationRequestInfo> request_info); 48 std::unique_ptr<NavigationRequestInfo> request_info);
47 49
48 // Follows the current pending redirect. 50 // Follows the current pending redirect.
49 void FollowRedirect(); 51 void FollowRedirect();
50 52
51 // Proceeds with processing the response. 53 // Proceeds with processing the response.
52 void ProceedWithResponse(); 54 void ProceedWithResponse();
53 55
54 void set_resource_handler(NavigationResourceHandler* resource_handler) { 56 void set_resource_handler(NavigationResourceHandler* resource_handler) {
55 resource_handler_ = resource_handler; 57 resource_handler_ = resource_handler;
56 } 58 }
57 59
58 // Notifies |loader_| on the UI thread that the request was redirected. 60 // Notifies |loader_| on the UI thread that the request was redirected.
59 void NotifyRequestRedirected(const net::RedirectInfo& redirect_info, 61 void NotifyRequestRedirected(const net::RedirectInfo& redirect_info,
60 ResourceResponse* response); 62 ResourceResponse* response);
61 63
62 // Notifies |loader_| on the UI thread that the response started. 64 // Notifies |loader_| on the UI thread that the response started.
63 void NotifyResponseStarted(ResourceResponse* response, 65 void NotifyResponseStarted(ResourceResponse* response,
64 std::unique_ptr<StreamHandle> body, 66 std::unique_ptr<StreamHandle> body,
65 std::unique_ptr<NavigationData> navigation_data); 67 std::unique_ptr<NavigationData> navigation_data);
66 68
67 // Notifies |loader_| on the UI thread that the request failed. 69 // Notifies |loader_| on the UI thread that the request failed.
68 void NotifyRequestFailed(bool in_cache, int net_error); 70 void NotifyRequestFailed(bool in_cache, int net_error);
69 71
70 private: 72 private:
73 // Called when done checking whether the navigation has a ServiceWorker
74 // registered for it.
75 void OnServiceWorkerChecksPerformed(
76 ServiceWorkerStatusCode status,
77 const scoped_refptr<ServiceWorkerRegistration>& registration);
78
71 base::WeakPtr<NavigationURLLoaderImpl> loader_; 79 base::WeakPtr<NavigationURLLoaderImpl> loader_;
72 NavigationResourceHandler* resource_handler_; 80 NavigationResourceHandler* resource_handler_;
81 std::unique_ptr<NavigationRequestInfo> request_info_;
82 ResourceContext* resource_context_;
83
84 base::WeakPtrFactory<NavigationURLLoaderImplCore> factory_;
73 85
74 DISALLOW_COPY_AND_ASSIGN(NavigationURLLoaderImplCore); 86 DISALLOW_COPY_AND_ASSIGN(NavigationURLLoaderImplCore);
75 }; 87 };
76 88
77 } // namespace content 89 } // namespace content
78 90
79 #endif // CONTENT_BROWSER_LOADER_NAVIGATION_URL_LOADER_IMPL_CORE_H_ 91 #endif // CONTENT_BROWSER_LOADER_NAVIGATION_URL_LOADER_IMPL_CORE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698