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

Side by Side Diff: content/browser/appcache/appcache_url_loader_factory.h

Issue 2893233002: Network traffic annotation added to URLLoaderImpl. (Closed)
Patch Set: Changed ParamTraits to StructTraits. 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_APPCACHE_APPCACHE_URL_LOADER_FACTORY_H_ 5 #ifndef CONTENT_BROWSER_APPCACHE_APPCACHE_URL_LOADER_FACTORY_H_
6 #define CONTENT_BROWSER_APPCACHE_APPCACHE_URL_LOADER_FACTORY_H_ 6 #define CONTENT_BROWSER_APPCACHE_APPCACHE_URL_LOADER_FACTORY_H_
7 7
8 #include "base/memory/ref_counted.h" 8 #include "base/memory/ref_counted.h"
9 #include "content/common/url_loader_factory.mojom.h" 9 #include "content/common/url_loader_factory.mojom.h"
10 #include "mojo/public/cpp/bindings/strong_binding_set.h" 10 #include "mojo/public/cpp/bindings/strong_binding_set.h"
11 #include "net/traffic_annotation/network_traffic_annotation.h"
11 #include "url/gurl.h" 12 #include "url/gurl.h"
12 13
13 namespace content { 14 namespace content {
14 class ChromeAppCacheService; 15 class ChromeAppCacheService;
15 class URLLoaderFactoryGetter; 16 class URLLoaderFactoryGetter;
16 17
17 // Implements the URLLoaderFactory mojom for AppCache requests. 18 // Implements the URLLoaderFactory mojom for AppCache requests.
18 class AppCacheURLLoaderFactory : public mojom::URLLoaderFactory { 19 class AppCacheURLLoaderFactory : public mojom::URLLoaderFactory {
19 public: 20 public:
20 ~AppCacheURLLoaderFactory() override; 21 ~AppCacheURLLoaderFactory() override;
21 22
22 // Factory function to create an instance of the factory. 23 // Factory function to create an instance of the factory.
23 // The |appcache_service| parameter is used to query the underlying 24 // The |appcache_service| parameter is used to query the underlying
24 // AppCacheStorage instance to check if we can service requests from the 25 // AppCacheStorage instance to check if we can service requests from the
25 // AppCache. We pass unhandled requests to the network service retrieved from 26 // AppCache. We pass unhandled requests to the network service retrieved from
26 // the |factory_getter|. 27 // the |factory_getter|.
27 static void CreateURLLoaderFactory(mojom::URLLoaderFactoryRequest request, 28 static void CreateURLLoaderFactory(mojom::URLLoaderFactoryRequest request,
28 ChromeAppCacheService* appcache_service, 29 ChromeAppCacheService* appcache_service,
29 URLLoaderFactoryGetter* factory_getter); 30 URLLoaderFactoryGetter* factory_getter);
30 31
31 // mojom::URLLoaderFactory implementation. 32 // mojom::URLLoaderFactory implementation.
32 void CreateLoaderAndStart( 33 void CreateLoaderAndStart(
33 mojom::URLLoaderAssociatedRequest url_loader_request, 34 mojom::URLLoaderAssociatedRequest url_loader_request,
34 int32_t routing_id, 35 int32_t routing_id,
35 int32_t request_id, 36 int32_t request_id,
36 uint32_t options, 37 uint32_t options,
37 const ResourceRequest& request, 38 const ResourceRequest& request,
38 mojom::URLLoaderClientPtr client) override; 39 mojom::URLLoaderClientPtr client,
40 const net::MutableNetworkTrafficAnnotationTag& traffic_annotation)
41 override;
39 void SyncLoad(int32_t routing_id, 42 void SyncLoad(int32_t routing_id,
40 int32_t request_id, 43 int32_t request_id,
41 const ResourceRequest& request, 44 const ResourceRequest& request,
42 SyncLoadCallback callback) override; 45 SyncLoadCallback callback) override;
43 46
44 private: 47 private:
45 AppCacheURLLoaderFactory(ChromeAppCacheService* appcache_service, 48 AppCacheURLLoaderFactory(ChromeAppCacheService* appcache_service,
46 URLLoaderFactoryGetter* factory_getter); 49 URLLoaderFactoryGetter* factory_getter);
47 50
48 // Used to query AppCacheStorage to see if a request can be served out of the 51 // Used to query AppCacheStorage to see if a request can be served out of the
49 /// AppCache. 52 /// AppCache.
50 scoped_refptr<ChromeAppCacheService> appcache_service_; 53 scoped_refptr<ChromeAppCacheService> appcache_service_;
51 54
52 // Used to retrieve the network service factory to pass unhandled requests to 55 // Used to retrieve the network service factory to pass unhandled requests to
53 // the network service. 56 // the network service.
54 scoped_refptr<URLLoaderFactoryGetter> factory_getter_; 57 scoped_refptr<URLLoaderFactoryGetter> factory_getter_;
55 58
56 mojo::StrongBindingSet<mojom::URLLoaderFactory> loader_factory_bindings_; 59 mojo::StrongBindingSet<mojom::URLLoaderFactory> loader_factory_bindings_;
57 60
58 DISALLOW_COPY_AND_ASSIGN(AppCacheURLLoaderFactory); 61 DISALLOW_COPY_AND_ASSIGN(AppCacheURLLoaderFactory);
59 }; 62 };
60 63
61 } // namespace content 64 } // namespace content
62 65
63 #endif // CONTENT_BROWSER_APPCACHE_APPCACHE_URL_LOADER_FACTORY_H_ 66 #endif // CONTENT_BROWSER_APPCACHE_APPCACHE_URL_LOADER_FACTORY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698