OLD | NEW |
---|---|
(Empty) | |
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 | |
3 // found in the LICENSE file. | |
4 | |
5 #ifndef CHROME_BROWSER_NET_PROFILE_NETWORK_CONTEXT_SERVICE_H_ | |
6 #define CHROME_BROWSER_NET_PROFILE_NETWORK_CONTEXT_SERVICE_H_ | |
7 | |
8 #include "base/macros.h" | |
9 #include "components/keyed_service/core/keyed_service.h" | |
10 #include "content/public/common/network_service.mojom.h" | |
11 | |
12 class Profile; | |
13 | |
14 // KeyedService that initializes and provides access to the NetworkContexts for | |
15 // a Profile. This will eventually replace ProfileIOData. | |
16 class ProfileNetworkContextService : public KeyedService { | |
17 public: | |
18 explicit ProfileNetworkContextService(Profile* profile); | |
19 ~ProfileNetworkContextService() override; | |
20 | |
21 // Initializes |network_context_params| as needed to set up the | |
22 // ProfileIOData's main NetworkContext (Which the caller will need to send to | |
23 // the IOThread's in-process NetworkService). If the network service is | |
Randy Smith (Not in Mondays)
2017/07/19 19:31:10
I think this description ("which the caller ...")
mmenke
2017/07/19 20:35:38
It applies to both cases. When the network servic
| |
24 // disabled, this will be the NetworkContext returned by the MainContext() | |
25 // method, and use by all the requests associated with a profile. If the | |
Randy Smith (Not in Mondays)
2017/07/19 19:31:10
nit: "and used" (I think).
mmenke
2017/07/19 20:35:38
Done.
| |
26 // network service is enabled, this method is sitll used, but only legacy | |
Randy Smith (Not in Mondays)
2017/07/19 19:31:10
nit: still
mmenke
2017/07/19 20:35:38
Done.
| |
27 // requests going through the URLRequestContext interface instead of the | |
28 // NetworkContext interface will use the profile's NetworkContext, and the | |
29 // ProfileIOData's main network context will be configured not to use on-disk | |
30 // storage, as the network service will be using those files instead. | |
Randy Smith (Not in Mondays)
2017/07/19 19:31:10
To confirm: This means that the legacy interface (
mmenke
2017/07/19 20:35:37
Other way around, so we can test the new interface
| |
31 // | |
32 // Must be called before the system NetworkContext is first used. | |
Randy Smith (Not in Mondays)
2017/07/19 19:31:10
Hmmm. I'm having a hard time wrapping my brain ar
mmenke
2017/07/19 20:35:38
That's what the above paragraph was attempting to
| |
33 void SetUpProfileIODataMainContext( | |
34 content::mojom::NetworkContextRequest* network_context_request, | |
35 content::mojom::NetworkContextParamsPtr* network_context_params); | |
36 | |
37 // Returns the main NetworkContext for the BrowserContext. | |
38 content::mojom::NetworkContext* MainContext(); | |
39 | |
40 // Creates the main NetworkContext for the BrowserContext. Only called when | |
Randy Smith (Not in Mondays)
2017/07/19 19:31:10
nit, suggestion: "May only be called". I take hea
mmenke
2017/07/19 20:35:38
Done.
| |
41 // the network service is enabled. | |
42 content::mojom::NetworkContextPtr CreateMainNetworkContext(); | |
Randy Smith (Not in Mondays)
2017/07/19 19:31:10
As might be suggested by my confused questions ove
mmenke
2017/07/19 20:35:38
I don't think every use of a mojom::*Ptr should ha
| |
43 | |
44 private: | |
45 Profile* const profile_; | |
46 | |
47 // This is a NetworkContext that wraps ProfileIOData's main URLRequestContext. | |
48 // Always initialized in SetUpProfileIODataMainContext, but it's only returned | |
49 // by Context() when the network service is disabled. | |
50 content::mojom::NetworkContextPtr profile_io_data_main_network_context_; | |
51 | |
52 DISALLOW_COPY_AND_ASSIGN(ProfileNetworkContextService); | |
53 }; | |
54 | |
55 #endif // CHROME_BROWSER_NET_PROFILE_NETWORK_CONTEXT_SERVICE_H_ | |
OLD | NEW |