Index: chrome/browser/net/profile_network_context_service.h |
diff --git a/chrome/browser/net/profile_network_context_service.h b/chrome/browser/net/profile_network_context_service.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..80055047dd01f5495b8a1a8450efbf42570d53b7 |
--- /dev/null |
+++ b/chrome/browser/net/profile_network_context_service.h |
@@ -0,0 +1,55 @@ |
+// Copyright 2017 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef CHROME_BROWSER_NET_PROFILE_NETWORK_CONTEXT_SERVICE_H_ |
+#define CHROME_BROWSER_NET_PROFILE_NETWORK_CONTEXT_SERVICE_H_ |
+ |
+#include "base/macros.h" |
+#include "components/keyed_service/core/keyed_service.h" |
+#include "content/public/common/network_service.mojom.h" |
+ |
+class Profile; |
+ |
+// KeyedService that initializes and provides access to the NetworkContexts for |
+// a Profile. This will eventually replace ProfileIOData. |
+class ProfileNetworkContextService : public KeyedService { |
+ public: |
+ explicit ProfileNetworkContextService(Profile* profile); |
+ ~ProfileNetworkContextService() override; |
+ |
+ // Initializes |network_context_params| as needed to set up the |
+ // ProfileIOData's main NetworkContext (Which the caller will need to send to |
+ // 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
|
+ // disabled, this will be the NetworkContext returned by the MainContext() |
+ // 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.
|
+ // 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.
|
+ // requests going through the URLRequestContext interface instead of the |
+ // NetworkContext interface will use the profile's NetworkContext, and the |
+ // ProfileIOData's main network context will be configured not to use on-disk |
+ // 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
|
+ // |
+ // 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
|
+ void SetUpProfileIODataMainContext( |
+ content::mojom::NetworkContextRequest* network_context_request, |
+ content::mojom::NetworkContextParamsPtr* network_context_params); |
+ |
+ // Returns the main NetworkContext for the BrowserContext. |
+ content::mojom::NetworkContext* MainContext(); |
+ |
+ // 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.
|
+ // the network service is enabled. |
+ 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
|
+ |
+ private: |
+ Profile* const profile_; |
+ |
+ // This is a NetworkContext that wraps ProfileIOData's main URLRequestContext. |
+ // Always initialized in SetUpProfileIODataMainContext, but it's only returned |
+ // by Context() when the network service is disabled. |
+ content::mojom::NetworkContextPtr profile_io_data_main_network_context_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(ProfileNetworkContextService); |
+}; |
+ |
+#endif // CHROME_BROWSER_NET_PROFILE_NETWORK_CONTEXT_SERVICE_H_ |