OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 IOS_CHROME_BROWSER_NET_IOS_CHROME_URL_REQUEST_CONTEXT_GETTER_H_ | 5 #ifndef IOS_CHROME_BROWSER_NET_IOS_CHROME_URL_REQUEST_CONTEXT_GETTER_H_ |
6 #define IOS_CHROME_BROWSER_NET_IOS_CHROME_URL_REQUEST_CONTEXT_GETTER_H_ | 6 #define IOS_CHROME_BROWSER_NET_IOS_CHROME_URL_REQUEST_CONTEXT_GETTER_H_ |
7 | 7 |
8 #include "base/macros.h" | 8 #include "base/macros.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "ios/chrome/browser/net/net_types.h" | 10 #include "ios/chrome/browser/net/net_types.h" |
(...skipping 24 matching lines...) Expand all Loading... |
35 net::URLRequestContext* GetURLRequestContext() override; | 35 net::URLRequestContext* GetURLRequestContext() override; |
36 scoped_refptr<base::SingleThreadTaskRunner> GetNetworkTaskRunner() | 36 scoped_refptr<base::SingleThreadTaskRunner> GetNetworkTaskRunner() |
37 const override; | 37 const override; |
38 | 38 |
39 // Create an instance for use with an 'original' (non-OTR) profile. This is | 39 // Create an instance for use with an 'original' (non-OTR) profile. This is |
40 // expected to get called on the UI thread. | 40 // expected to get called on the UI thread. |
41 static IOSChromeURLRequestContextGetter* Create( | 41 static IOSChromeURLRequestContextGetter* Create( |
42 const ChromeBrowserStateIOData* io_data, | 42 const ChromeBrowserStateIOData* io_data, |
43 ProtocolHandlerMap* protocol_handlers); | 43 ProtocolHandlerMap* protocol_handlers); |
44 | 44 |
45 // Create an instance for an original profile for an app with isolated | |
46 // storage. This is expected to get called on UI thread. | |
47 static IOSChromeURLRequestContextGetter* CreateForIsolatedApp( | |
48 net::URLRequestContextGetter* main_context, | |
49 const ChromeBrowserStateIOData* io_data, | |
50 const base::FilePath& partition_path); | |
51 | |
52 // Discard reference to URLRequestContext and inform observers of shutdown. | 45 // Discard reference to URLRequestContext and inform observers of shutdown. |
53 // Must be called before destruction. May only be called on IO thread. | 46 // Must be called before destruction. May only be called on IO thread. |
54 void NotifyContextShuttingDown(); | 47 void NotifyContextShuttingDown(); |
55 | 48 |
56 private: | 49 private: |
57 ~IOSChromeURLRequestContextGetter() override; | 50 ~IOSChromeURLRequestContextGetter() override; |
58 | 51 |
59 // Deferred logic for creating a URLRequestContext. | 52 // Deferred logic for creating a URLRequestContext. |
60 // Access only from the IO thread. | 53 // Access only from the IO thread. |
61 scoped_ptr<IOSChromeURLRequestContextFactory> factory_; | 54 scoped_ptr<IOSChromeURLRequestContextFactory> factory_; |
62 | 55 |
63 // NULL before initialization and after invalidation. | 56 // NULL before initialization and after invalidation. |
64 // Otherwise, it is the URLRequestContext instance that | 57 // Otherwise, it is the URLRequestContext instance that |
65 // was lazily created by GetURLRequestContext(). | 58 // was lazily created by GetURLRequestContext(). |
66 // Access only from the IO thread. | 59 // Access only from the IO thread. |
67 net::URLRequestContext* url_request_context_; | 60 net::URLRequestContext* url_request_context_; |
68 | 61 |
69 DISALLOW_COPY_AND_ASSIGN(IOSChromeURLRequestContextGetter); | 62 DISALLOW_COPY_AND_ASSIGN(IOSChromeURLRequestContextGetter); |
70 }; | 63 }; |
71 | 64 |
72 #endif // IOS_CHROME_BROWSER_NET_IOS_CHROME_URL_REQUEST_CONTEXT_GETTER_H_ | 65 #endif // IOS_CHROME_BROWSER_NET_IOS_CHROME_URL_REQUEST_CONTEXT_GETTER_H_ |
OLD | NEW |