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: Fix compile failures 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 // Overrides the network URLLoaderFactory for subsequent requests. Passing a 35 // Overrides the network URLLoaderFactory for subsequent requests. Passing a
37 // null pointer will restore the default behavior. 36 // null pointer will restore the default behavior.
38 // This is called on the UI thread. 37 // This is called on the UI thread.
39 CONTENT_EXPORT void SetNetworkFactoryForTesting( 38 CONTENT_EXPORT void SetNetworkFactoryForTesting(
40 mojom::URLLoaderFactoryPtr test_factory); 39 mojom::URLLoaderFactoryPtr test_factory);
41 40
42 // Called on the IO thread to get the URLLoaderFactory for AppCache. The
43 // pointer should not be cached.
44 mojom::URLLoaderFactoryPtr* GetAppCacheFactory();
45
46 private: 41 private:
47 friend class base::DeleteHelper<URLLoaderFactoryGetter>; 42 friend class base::DeleteHelper<URLLoaderFactoryGetter>;
48 friend struct BrowserThread::DeleteOnThread<BrowserThread::IO>; 43 friend struct BrowserThread::DeleteOnThread<BrowserThread::IO>;
49 44
50 CONTENT_EXPORT ~URLLoaderFactoryGetter(); 45 CONTENT_EXPORT ~URLLoaderFactoryGetter();
51 void InitializeOnIOThread( 46 void InitializeOnIOThread(mojom::URLLoaderFactoryPtrInfo network_factory);
52 mojom::URLLoaderFactoryPtrInfo network_factory,
53 scoped_refptr<ChromeAppCacheService> appcache_service);
54 void SetTestNetworkFactoryOnIOThread( 47 void SetTestNetworkFactoryOnIOThread(
55 mojom::URLLoaderFactoryPtrInfo test_factory); 48 mojom::URLLoaderFactoryPtrInfo test_factory);
56 49
57 // Only accessed on IO thread. 50 // Only accessed on IO thread.
58 mojom::URLLoaderFactoryPtr network_factory_; 51 mojom::URLLoaderFactoryPtr network_factory_;
59 mojom::URLLoaderFactoryPtr test_factory_; 52 mojom::URLLoaderFactoryPtr test_factory_;
60 mojom::URLLoaderFactoryPtr appcache_factory_;
61 53
62 DISALLOW_COPY_AND_ASSIGN(URLLoaderFactoryGetter); 54 DISALLOW_COPY_AND_ASSIGN(URLLoaderFactoryGetter);
63 }; 55 };
64 56
65 } // namespace content 57 } // namespace content
66 58
67 #endif // CONTENT_BROWSER_URL_LOADER_FACTORY_GETTER_H_ 59 #endif // CONTENT_BROWSER_URL_LOADER_FACTORY_GETTER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698