Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(30)

Side by Side Diff: chrome/browser/net/profile_network_context_service.h

Issue 2976323002: Hook up ProfileIOData's URLRequestContext to a NetworkService. (Closed)
Patch Set: Response to comments Created 3 years, 5 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
(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| to set up the ProfileIOData's
22 // main URLRequestContext and |*network_context_request| to be one end of a
23 // Mojo pipe to be bound to the NetworkContext for that URLRequestContext.
24 // The caller will need to send these parameters to the IOThread's in-process
25 // NetworkService. This class retains the NetworkContext at the other end of
26 // the |*network_context_request| pipe for later vending.
27 //
28 // If the network service is disabled, MainContext() will return that end of
29 // the pipe. In this case, all requests associated with this profile will use
30 // the associated URLRequestContext (either through MainContext() or
31 // directly).
32 //
33 // If the network service is enabled, MainContext() will instead return a
34 // network context vended by the network service's NetworkService (Instead of
35 // the IOThread's in-process one). In this case, the ProfileIOData's
36 // URLRequest context will be configured not to use on-disk storage (so as not
37 // to conflict with the network service vended context), and will only be used
38 // for legacy requests that use it directly.
39 //
40 // Must be called before anything uses the NetworkContext vended by this
41 // class.
42 void SetUpProfileIODataMainContext(
43 content::mojom::NetworkContextRequest* network_context_request,
44 content::mojom::NetworkContextParamsPtr* network_context_params);
45
46 // Returns the main NetworkContext for the BrowserContext. If the network
47 // service is disabled, this will be the
48 // ProfileIOData NetworkContext set up above. Otherwise, it will be a
49 // NetworkContext vended from the network service.
50 content::mojom::NetworkContext* MainContext();
51
52 // Creates the main NetworkContext for the BrowserContext, using the network
53 // service. May only be called when the network service is enabled. Must only
54 // be called once for a profile, from the ChromeContentBrowserClient.
55 content::mojom::NetworkContextPtr CreateMainNetworkContext();
56
57 private:
58 Profile* const profile_;
59
60 // This is a NetworkContext that wraps ProfileIOData's main URLRequestContext.
61 // Always initialized in SetUpProfileIODataMainContext, but it's only returned
62 // by Context() when the network service is disabled.
63 content::mojom::NetworkContextPtr profile_io_data_main_network_context_;
64
65 DISALLOW_COPY_AND_ASSIGN(ProfileNetworkContextService);
66 };
67
68 #endif // CHROME_BROWSER_NET_PROFILE_NETWORK_CONTEXT_SERVICE_H_
OLDNEW
« no previous file with comments | « chrome/browser/net/network_context_configuration_browsertest.cc ('k') | chrome/browser/net/profile_network_context_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698