OLD | NEW |
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_URL_LOADER_FACTORY_GETTER_H_ | 5 #ifndef CONTENT_BROWSER_URL_LOADER_FACTORY_GETTER_H_ |
6 #define CONTENT_BROWSER_URL_LOADER_FACTORY_GETTER_H_ | 6 #define CONTENT_BROWSER_URL_LOADER_FACTORY_GETTER_H_ |
7 | 7 |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "content/common/content_export.h" | 10 #include "content/common/content_export.h" |
(...skipping 15 matching lines...) Expand all Loading... |
26 URLLoaderFactoryGetter(); | 26 URLLoaderFactoryGetter(); |
27 | 27 |
28 // Initializes this object on the UI thread. The |partition| is used to | 28 // Initializes this object on the UI thread. The |partition| is used to |
29 // initialize the URLLoaderFactories for the network service and AppCache. | 29 // initialize the URLLoaderFactories for the network service and AppCache. |
30 void Initialize(StoragePartitionImpl* partition); | 30 void Initialize(StoragePartitionImpl* partition); |
31 | 31 |
32 // Called on the IO thread to get the URLLoaderFactory to the network service. | 32 // Called on the IO thread to get the URLLoaderFactory to the network service. |
33 // The pointer shouldn't be cached. | 33 // The pointer shouldn't be cached. |
34 mojom::URLLoaderFactoryPtr* GetNetworkFactory(); | 34 mojom::URLLoaderFactoryPtr* GetNetworkFactory(); |
35 | 35 |
| 36 // Called on the IO thread to get the URLLoaderFactory to the blob service. |
| 37 // The pointer shouldn't be cached. |
| 38 mojom::URLLoaderFactoryPtr* GetBlobFactory(); |
| 39 |
36 // Overrides the network URLLoaderFactory for subsequent requests. Passing a | 40 // Overrides the network URLLoaderFactory for subsequent requests. Passing a |
37 // null pointer will restore the default behavior. | 41 // null pointer will restore the default behavior. |
38 // This is called on the UI thread. | 42 // This is called on the UI thread. |
39 CONTENT_EXPORT void SetNetworkFactoryForTesting( | 43 CONTENT_EXPORT void SetNetworkFactoryForTesting( |
40 mojom::URLLoaderFactoryPtr test_factory); | 44 mojom::URLLoaderFactoryPtr test_factory); |
41 | 45 |
42 // Called on the IO thread to get the URLLoaderFactory for AppCache. The | 46 // Called on the IO thread to get the URLLoaderFactory for AppCache. The |
43 // pointer should not be cached. | 47 // pointer should not be cached. |
44 mojom::URLLoaderFactoryPtr* GetAppCacheFactory(); | 48 mojom::URLLoaderFactoryPtr* GetAppCacheFactory(); |
45 | 49 |
46 private: | 50 private: |
47 friend class base::DeleteHelper<URLLoaderFactoryGetter>; | 51 friend class base::DeleteHelper<URLLoaderFactoryGetter>; |
48 friend struct BrowserThread::DeleteOnThread<BrowserThread::IO>; | 52 friend struct BrowserThread::DeleteOnThread<BrowserThread::IO>; |
49 | 53 |
50 CONTENT_EXPORT ~URLLoaderFactoryGetter(); | 54 CONTENT_EXPORT ~URLLoaderFactoryGetter(); |
51 void InitializeOnIOThread( | 55 void InitializeOnIOThread( |
52 mojom::URLLoaderFactoryPtrInfo network_factory, | 56 mojom::URLLoaderFactoryPtrInfo network_factory, |
| 57 mojom::URLLoaderFactoryPtrInfo blob_factory, |
53 scoped_refptr<ChromeAppCacheService> appcache_service); | 58 scoped_refptr<ChromeAppCacheService> appcache_service); |
54 void SetTestNetworkFactoryOnIOThread( | 59 void SetTestNetworkFactoryOnIOThread( |
55 mojom::URLLoaderFactoryPtrInfo test_factory); | 60 mojom::URLLoaderFactoryPtrInfo test_factory); |
56 | 61 |
57 // Only accessed on IO thread. | 62 // Only accessed on IO thread. |
58 mojom::URLLoaderFactoryPtr network_factory_; | 63 mojom::URLLoaderFactoryPtr network_factory_; |
| 64 mojom::URLLoaderFactoryPtr appcache_factory_; |
| 65 mojom::URLLoaderFactoryPtr blob_factory_; |
59 mojom::URLLoaderFactoryPtr test_factory_; | 66 mojom::URLLoaderFactoryPtr test_factory_; |
60 mojom::URLLoaderFactoryPtr appcache_factory_; | |
61 | 67 |
62 DISALLOW_COPY_AND_ASSIGN(URLLoaderFactoryGetter); | 68 DISALLOW_COPY_AND_ASSIGN(URLLoaderFactoryGetter); |
63 }; | 69 }; |
64 | 70 |
65 } // namespace content | 71 } // namespace content |
66 | 72 |
67 #endif // CONTENT_BROWSER_URL_LOADER_FACTORY_GETTER_H_ | 73 #endif // CONTENT_BROWSER_URL_LOADER_FACTORY_GETTER_H_ |
OLD | NEW |