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

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

Issue 2924723002: Network service: SafeBrowsing check for frame-resources from browser. (Closed)
Patch Set: . Created 3 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 2017 The Chromium Authors. All rights reserved. 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 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_NETWORK_SERVICE_H_ 5 #ifndef CONTENT_BROWSER_LOADER_NAVIGATION_URL_LOADER_NETWORK_SERVICE_H_
6 #define CONTENT_BROWSER_LOADER_NAVIGATION_URL_LOADER_NETWORK_SERVICE_H_ 6 #define CONTENT_BROWSER_LOADER_NAVIGATION_URL_LOADER_NETWORK_SERVICE_H_
7 7
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "base/memory/weak_ptr.h"
9 #include "content/browser/loader/navigation_url_loader.h" 10 #include "content/browser/loader/navigation_url_loader.h"
10 #include "content/common/url_loader.mojom.h" 11 #include "content/common/url_loader.mojom.h"
11 #include "content/common/url_loader_factory.mojom.h"
12 #include "content/public/browser/ssl_status.h" 12 #include "content/public/browser/ssl_status.h"
13 #include "mojo/public/cpp/bindings/binding.h"
14 #include "services/service_manager/public/cpp/connector.h"
15 13
16 namespace net { 14 namespace net {
17 struct RedirectInfo; 15 struct RedirectInfo;
18 } 16 }
19 17
20 namespace content { 18 namespace content {
21 19
22 class ResourceContext; 20 class ResourceContext;
23 class NavigationPostDataHandler; 21 class NavigationPostDataHandler;
24 22
25 // This is an implementation of NavigationURLLoader used when 23 // This is an implementation of NavigationURLLoader used when
26 // --enable-network-service is used. 24 // --enable-network-service is used.
27 class NavigationURLLoaderNetworkService : public NavigationURLLoader, 25 class NavigationURLLoaderNetworkService : public NavigationURLLoader {
28 public mojom::URLLoaderClient {
29 public: 26 public:
30 // The caller is responsible for ensuring that |delegate| outlives the loader. 27 // The caller is responsible for ensuring that |delegate| outlives the loader.
31 NavigationURLLoaderNetworkService( 28 NavigationURLLoaderNetworkService(
32 ResourceContext* resource_context, 29 ResourceContext* resource_context,
33 StoragePartition* storage_partition, 30 StoragePartition* storage_partition,
34 std::unique_ptr<NavigationRequestInfo> request_info, 31 std::unique_ptr<NavigationRequestInfo> request_info,
35 std::unique_ptr<NavigationUIData> navigation_ui_data, 32 std::unique_ptr<NavigationUIData> navigation_ui_data,
36 ServiceWorkerNavigationHandle* service_worker_handle, 33 ServiceWorkerNavigationHandle* service_worker_handle,
37 AppCacheNavigationHandle* appcache_handle, 34 AppCacheNavigationHandle* appcache_handle,
38 NavigationURLLoaderDelegate* delegate); 35 NavigationURLLoaderDelegate* delegate);
39 ~NavigationURLLoaderNetworkService() override; 36 ~NavigationURLLoaderNetworkService() override;
40 37
41 // NavigationURLLoader implementation: 38 // NavigationURLLoader implementation:
42 void FollowRedirect() override; 39 void FollowRedirect() override;
43 void ProceedWithResponse() override; 40 void ProceedWithResponse() override;
44 41
45 // mojom::URLLoaderClient implementation:
46 void OnReceiveResponse(const ResourceResponseHead& head, 42 void OnReceiveResponse(const ResourceResponseHead& head,
47 const base::Optional<net::SSLInfo>& ssl_info, 43 const base::Optional<net::SSLInfo>& ssl_info,
48 mojom::DownloadedTempFilePtr downloaded_file) override; 44 mojom::DownloadedTempFilePtr downloaded_file);
49 void OnReceiveRedirect(const net::RedirectInfo& redirect_info, 45 void OnReceiveRedirect(const net::RedirectInfo& redirect_info,
50 const ResourceResponseHead& head) override; 46 const ResourceResponseHead& head);
51 void OnDataDownloaded(int64_t data_length, int64_t encoded_length) override; 47 void OnStartLoadingResponseBody(mojo::ScopedDataPipeConsumerHandle body);
52 void OnUploadProgress(int64_t current_position, 48 void OnComplete(const ResourceRequestCompletionStatus& completion_status);
53 int64_t total_size,
54 OnUploadProgressCallback callback) override;
55 void OnReceiveCachedMetadata(const std::vector<uint8_t>& data) override;
56 void OnTransferSizeUpdated(int32_t transfer_size_diff) override;
57 void OnStartLoadingResponseBody(
58 mojo::ScopedDataPipeConsumerHandle body) override;
59 void OnComplete(
60 const ResourceRequestCompletionStatus& completion_status) override;
61 49
62 private: 50 private:
63 class URLLoaderRequestController; 51 class URLLoaderRequestController;
64 52
65 NavigationURLLoaderDelegate* delegate_; 53 NavigationURLLoaderDelegate* delegate_;
66 54
67 mojo::Binding<mojom::URLLoaderClient> binding_;
68 mojom::URLLoaderPtr url_loader_ptr_;
69 scoped_refptr<ResourceResponse> response_; 55 scoped_refptr<ResourceResponse> response_;
70 SSLStatus ssl_status_; 56 SSLStatus ssl_status_;
71 57
72 // Lives on the IO thread. 58 // Lives on the IO thread.
73 std::unique_ptr<URLLoaderRequestController> request_controller_; 59 std::unique_ptr<URLLoaderRequestController> request_controller_;
74 60
61 base::WeakPtrFactory<NavigationURLLoaderNetworkService> weak_factory_;
62
75 DISALLOW_COPY_AND_ASSIGN(NavigationURLLoaderNetworkService); 63 DISALLOW_COPY_AND_ASSIGN(NavigationURLLoaderNetworkService);
76 }; 64 };
77 65
78 } // namespace content 66 } // namespace content
79 67
80 #endif // CONTENT_BROWSER_LOADER_NAVIGATION_URL_LOADER_NETWORK_SERVICE_H_ 68 #endif // CONTENT_BROWSER_LOADER_NAVIGATION_URL_LOADER_NETWORK_SERVICE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698