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

Side by Side Diff: content/browser/url_loader_factory_getter.h

Issue 2902653002: Get main frame and subframe AppCache loads to work. (Closed)
Patch Set: Address review comments 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_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"
11 #include "content/common/url_loader_factory.mojom.h" 11 #include "content/common/url_loader_factory.mojom.h"
12 #include "content/public/browser/browser_thread.h" 12 #include "content/public/browser/browser_thread.h"
13 13
14 namespace content { 14 namespace content {
15 15
16 class ChromeAppCacheService;
17 class StoragePartitionImpl; 16 class StoragePartitionImpl;
18 17
19 // Holds on to URLLoaderFactory for a given StoragePartition and allows code 18 // Holds on to URLLoaderFactory for a given StoragePartition and allows code
20 // running on the IO thread to access them. Note these are the factories used by 19 // running on the IO thread to access them. Note these are the factories used by
21 // the browser process for frame requests. 20 // the browser process for frame requests.
22 class URLLoaderFactoryGetter 21 class URLLoaderFactoryGetter
23 : public base::RefCountedThreadSafe<URLLoaderFactoryGetter, 22 : public base::RefCountedThreadSafe<URLLoaderFactoryGetter,
24 BrowserThread::DeleteOnIOThread> { 23 BrowserThread::DeleteOnIOThread> {
25 public: 24 public:
26 URLLoaderFactoryGetter(); 25 URLLoaderFactoryGetter();
27 26
28 // Initializes this object on the UI thread. The |partition| is used to 27 // Initializes this object on the UI thread. The |partition| is used to
29 // initialize the URLLoaderFactories for the network service and AppCache. 28 // initialize the URLLoaderFactories for the network service and AppCache.
30 void Initialize(StoragePartitionImpl* partition); 29 void Initialize(StoragePartitionImpl* partition);
31 30
32 // Called on the IO thread to get the URLLoaderFactory to the network service. 31 // Called on the IO thread to get the URLLoaderFactory to the network service.
33 // The pointer shouldn't be cached. 32 // The pointer shouldn't be cached.
34 mojom::URLLoaderFactoryPtr* GetNetworkFactory(); 33 mojom::URLLoaderFactoryPtr* GetNetworkFactory();
35 34
36 // Called on the IO thread to get the URLLoaderFactory to the blob service. 35 // Called on the IO thread to get the URLLoaderFactory to the blob service.
37 // The pointer shouldn't be cached. 36 // The pointer shouldn't be cached.
38 CONTENT_EXPORT mojom::URLLoaderFactoryPtr* GetBlobFactory(); 37 CONTENT_EXPORT mojom::URLLoaderFactoryPtr* GetBlobFactory();
39 38
40 // Overrides the network URLLoaderFactory for subsequent requests. Passing a 39 // Overrides the network URLLoaderFactory for subsequent requests. Passing a
41 // null pointer will restore the default behavior. 40 // null pointer will restore the default behavior.
42 // This is called on the UI thread. 41 // This is called on the UI thread.
43 CONTENT_EXPORT void SetNetworkFactoryForTesting( 42 CONTENT_EXPORT void SetNetworkFactoryForTesting(
44 mojom::URLLoaderFactoryPtr test_factory); 43 mojom::URLLoaderFactoryPtr test_factory);
45 44
46 // Called on the IO thread to get the URLLoaderFactory for AppCache. The
47 // pointer should not be cached.
48 mojom::URLLoaderFactoryPtr* GetAppCacheFactory();
49
50 private: 45 private:
51 friend class base::DeleteHelper<URLLoaderFactoryGetter>; 46 friend class base::DeleteHelper<URLLoaderFactoryGetter>;
52 friend struct BrowserThread::DeleteOnThread<BrowserThread::IO>; 47 friend struct BrowserThread::DeleteOnThread<BrowserThread::IO>;
53 48
54 CONTENT_EXPORT ~URLLoaderFactoryGetter(); 49 CONTENT_EXPORT ~URLLoaderFactoryGetter();
55 void InitializeOnIOThread( 50 void InitializeOnIOThread(mojom::URLLoaderFactoryPtrInfo network_factory,
56 mojom::URLLoaderFactoryPtrInfo network_factory, 51 mojom::URLLoaderFactoryPtrInfo blob_factory);
57 mojom::URLLoaderFactoryPtrInfo blob_factory,
58 scoped_refptr<ChromeAppCacheService> appcache_service);
59 void SetTestNetworkFactoryOnIOThread( 52 void SetTestNetworkFactoryOnIOThread(
60 mojom::URLLoaderFactoryPtrInfo test_factory); 53 mojom::URLLoaderFactoryPtrInfo test_factory);
61 54
62 // Only accessed on IO thread. 55 // Only accessed on IO thread.
63 mojom::URLLoaderFactoryPtr network_factory_; 56 mojom::URLLoaderFactoryPtr network_factory_;
64 mojom::URLLoaderFactoryPtr appcache_factory_;
65 mojom::URLLoaderFactoryPtr blob_factory_; 57 mojom::URLLoaderFactoryPtr blob_factory_;
66 mojom::URLLoaderFactoryPtr test_factory_; 58 mojom::URLLoaderFactoryPtr test_factory_;
67 59
68 DISALLOW_COPY_AND_ASSIGN(URLLoaderFactoryGetter); 60 DISALLOW_COPY_AND_ASSIGN(URLLoaderFactoryGetter);
69 }; 61 };
70 62
71 } // namespace content 63 } // namespace content
72 64
73 #endif // CONTENT_BROWSER_URL_LOADER_FACTORY_GETTER_H_ 65 #endif // CONTENT_BROWSER_URL_LOADER_FACTORY_GETTER_H_
OLDNEW
« no previous file with comments | « content/browser/loader/navigation_url_loader_network_service.cc ('k') | content/browser/url_loader_factory_getter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698