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..87e66182d5e7c62b9e416fae09ff55adddeeffde |
--- /dev/null |
+++ b/chrome/browser/net/profile_network_context_service.h |
@@ -0,0 +1,57 @@ |
+// 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 URLRequestContext (Which the caller will need to send |
+ // to the IOThread's in-process NetworkService). If the network service is |
+ // disabled, this will be the NetworkContext returned by the MainContext() |
+ // method, and used by all the requests associated with a profile. If the |
+ // network service is enabled, this method is still used, but only legacy |
+ // requests going through the URLRequestContext interface instead of the |
+ // NetworkContext interface will use the ProfileIOData's URLRequestContext, |
+ // and the ProfileIOData's main URLRequestContext 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/20 17:38:34
Ok, I do find this clearer. It's still somewhat h
mmenke
2017/07/20 18:31:30
Thanks so much for the detailed text - I think it'
|
+ // |
+ // Must be called before the system NetworkContext is first used. |
+ void SetUpProfileIODataMainContext( |
+ content::mojom::NetworkContextRequest* network_context_request, |
+ content::mojom::NetworkContextParamsPtr* network_context_params); |
+ |
+ // Returns the main NetworkContext for the BrowserContext. |
Randy Smith (Not in Mondays)
2017/07/20 17:38:34
suggestion: Add "If the network service is disable
mmenke
2017/07/20 18:31:30
Done.
|
+ content::mojom::NetworkContext* MainContext(); |
+ |
+ // Creates the main NetworkContext for the BrowserContext. May only be called |
Randy Smith (Not in Mondays)
2017/07/20 17:38:34
Suggest adding to first sentence ", by requesting
mmenke
2017/07/20 18:31:30
Done (Added "using the network service", "requesti
|
+ // when the network service is enabled. Must only be called once for a |
+ // profile, from the ChromeContentBrowserClient. |
+ content::mojom::NetworkContextPtr CreateMainNetworkContext(); |
+ |
+ 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_ |