1 // Copyright 2017 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_NAVIGATION_SUBRESOURCE_LOADER_PARAMS_H_
6 #define CONTENT_BROWSER_NAVIGATION_SUBRESOURCE_LOADER_PARAMS_H_
7 
8 #include "base/memory/weak_ptr.h"
9 #include "content/common/content_export.h"
10 #include "content/common/prefetched_signed_exchange_info.mojom.h"
11 #include "services/network/public/mojom/url_loader_factory.mojom.h"
12 #include "third_party/blink/public/mojom/service_worker/controller_service_worker.mojom.h"
13 
14 namespace content {
15 
16 class ServiceWorkerObjectHost;
17 
18 // For NetworkService glues:
19 // Navigation parameters that are necessary to set-up a subresource loader
20 // for the frame that is going to be created by the navigation.
21 // Passed from the browser to the renderer when the navigation commits when
22 // NetworkService or its glue code for relevant features is enabled.
23 struct CONTENT_EXPORT SubresourceLoaderParams {
24   SubresourceLoaderParams();
25   ~SubresourceLoaderParams();
26 
27   SubresourceLoaderParams(SubresourceLoaderParams&& other);
28   SubresourceLoaderParams& operator=(SubresourceLoaderParams&& other);
29 
30   // For AppCache.
31   // Subresource loader factory info for appcache, that is to be used to
32   // create a subresource loader in the renderer.
33   mojo::PendingRemote<network::mojom::URLLoaderFactory>
34       pending_appcache_loader_factory;
35 
36   // For ServiceWorkers.
37   // The controller service worker, non-null if the frame is to be
38   // controlled by the service worker.
39   //
40   // |controller_service_worker_info->object_info| is "incomplete". It must be
41   // updated before being sent over Mojo and then registered with
42   // |controller_service_worker_object_host|. See
43   // ServiceWorkerObjectHost::CreateIncompleteObjectInfo() for details.
44   blink::mojom::ControllerServiceWorkerInfoPtr controller_service_worker_info;
45   base::WeakPtr<ServiceWorkerObjectHost> controller_service_worker_object_host;
46 
47   // For SignedExchangeSubresourcePrefetch.
48   // When signed exchanges were prefetched in the previous page and were stored
49   // to the PrefetchedSignedExchangeCache, and the main resource for the
50   // navigation was served from the cache, |prefetched_signed_exchanges|
51   // contains the all prefetched signed exchanges and they will be passed to the
52   // renderer.
53   std::vector<mojom::PrefetchedSignedExchangeInfoPtr>
54       prefetched_signed_exchanges;
55 };
56 
57 }  // namespace content
58 
59 #endif  // CONTENT_BROWSER_NAVIGATION_SUBRESOURCE_LOADER_PARAMS_H_
60