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

Side by Side Diff: content/browser/loader/navigation_url_loader_impl.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, 5 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_H_ 5 #ifndef CONTENT_BROWSER_LOADER_NAVIGATION_URL_LOADER_IMPL_H_
6 #define CONTENT_BROWSER_LOADER_NAVIGATION_URL_LOADER_IMPL_H_ 6 #define CONTENT_BROWSER_LOADER_NAVIGATION_URL_LOADER_IMPL_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/ref_counted.h" 11 #include "base/memory/ref_counted.h"
12 #include "base/memory/weak_ptr.h" 12 #include "base/memory/weak_ptr.h"
13 #include "base/time/time.h" 13 #include "base/time/time.h"
14 #include "content/browser/loader/navigation_url_loader.h" 14 #include "content/browser/loader/navigation_url_loader.h"
15 15
16 namespace net { 16 namespace net {
17 struct RedirectInfo; 17 struct RedirectInfo;
18 } 18 }
19 19
20 namespace content { 20 namespace content {
21 21
22 class NavigationURLLoaderImplCore; 22 class NavigationURLLoaderImplCore;
23 class NavigationData; 23 class NavigationData;
24 class ServiceWorkerNavigationHandle; 24 class ServiceWorkerContextWrapper;
25 class StreamHandle; 25 class StreamHandle;
26 struct ResourceResponse; 26 struct ResourceResponse;
27 27
28 class NavigationURLLoaderImpl : public NavigationURLLoader { 28 class NavigationURLLoaderImpl : public NavigationURLLoader {
29 public: 29 public:
30 // The caller is responsible for ensuring that |delegate| outlives the loader. 30 // The caller is responsible for ensuring that |delegate| outlives the loader.
31 NavigationURLLoaderImpl(BrowserContext* browser_context, 31 NavigationURLLoaderImpl(
32 std::unique_ptr<NavigationRequestInfo> request_info, 32 BrowserContext* browser_context,
33 ServiceWorkerNavigationHandle* service_worker_handle, 33 std::unique_ptr<NavigationRequestInfo> request_info,
34 NavigationURLLoaderDelegate* delegate); 34 ServiceWorkerContextWrapper* service_worker_context_wrapper,
35 NavigationURLLoaderDelegate* delegate);
35 ~NavigationURLLoaderImpl() override; 36 ~NavigationURLLoaderImpl() override;
36 37
37 // NavigationURLLoader implementation. 38 // NavigationURLLoader implementation.
38 void FollowRedirect() override; 39 void FollowRedirect() override;
39 void ProceedWithResponse() override; 40 void ProceedWithResponse() override;
40 41
41 private: 42 private:
42 friend class NavigationURLLoaderImplCore; 43 friend class NavigationURLLoaderImplCore;
43 44
44 // Notifies the delegate of a redirect. 45 // Notifies the delegate of a redirect.
45 void NotifyRequestRedirected(const net::RedirectInfo& redirect_info, 46 void NotifyRequestRedirected(const net::RedirectInfo& redirect_info,
46 const scoped_refptr<ResourceResponse>& response); 47 const scoped_refptr<ResourceResponse>& response);
47 48
48 // Notifies the delegate that the response has started. 49 // Notifies the delegate that the response has started.
49 void NotifyResponseStarted(const scoped_refptr<ResourceResponse>& response, 50 void NotifyResponseStarted(const scoped_refptr<ResourceResponse>& response,
50 std::unique_ptr<StreamHandle> body, 51 std::unique_ptr<StreamHandle> body,
51 std::unique_ptr<NavigationData> navigation_data); 52 std::unique_ptr<NavigationData> navigation_data);
52 53
53 // Notifies the delegate the request failed to return a response. 54 // Notifies the delegate the request failed to return a response.
54 void NotifyRequestFailed(bool in_cache, int net_error); 55 void NotifyRequestFailed(bool in_cache, int net_error);
55 56
56 // Notifies the delegate the begin navigation request was handled and a 57 // Notifies the delegate the begin navigation request was handled and a
57 // potential first network request is about to be made. 58 // potential first network request is about to be made.
58 void NotifyRequestStarted(base::TimeTicks timestamp); 59 void NotifyRequestStarted(base::TimeTicks timestamp);
59 60
61 // Notifies the delegate that a ServiceWorker was found for this navigation.
62 void NotifyServiceWorkerEncountered();
63
60 NavigationURLLoaderDelegate* delegate_; 64 NavigationURLLoaderDelegate* delegate_;
61 65
62 // |core_| is deleted on the IO thread in a subsequent task when the 66 // |core_| is deleted on the IO thread in a subsequent task when the
63 // NavigationURLLoaderImpl goes out of scope. 67 // NavigationURLLoaderImpl goes out of scope.
64 NavigationURLLoaderImplCore* core_; 68 NavigationURLLoaderImplCore* core_;
65 69
66 base::WeakPtrFactory<NavigationURLLoaderImpl> weak_factory_; 70 base::WeakPtrFactory<NavigationURLLoaderImpl> weak_factory_;
67 71
68 DISALLOW_COPY_AND_ASSIGN(NavigationURLLoaderImpl); 72 DISALLOW_COPY_AND_ASSIGN(NavigationURLLoaderImpl);
69 }; 73 };
70 74
71 } // namespace content 75 } // namespace content
72 76
73 #endif // CONTENT_BROWSER_LOADER_NAVIGATION_URL_LOADER_IMPL_H_ 77 #endif // CONTENT_BROWSER_LOADER_NAVIGATION_URL_LOADER_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698