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

Side by Side Diff: content/network/network_service.h

Issue 2874163004: Add support in the network service for different contexts. (Closed)
Patch Set: review comment and clang fixes Created 3 years, 7 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
« no previous file with comments | « content/network/network_context.cc ('k') | content/network/network_service.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 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 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 CONTENT_NETWORK_NETWORK_SERVICE_H_ 5 #ifndef CONTENT_NETWORK_NETWORK_SERVICE_H_
6 #define CONTENT_NETWORK_NETWORK_SERVICE_H_ 6 #define CONTENT_NETWORK_NETWORK_SERVICE_H_
7 7
8 #include <memory> 8 #include <memory>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
11 #include "content/common/network_service.mojom.h" 11 #include "content/common/network_service.mojom.h"
12 #include "content/common/url_loader_factory.mojom.h" 12 #include "mojo/public/cpp/bindings/binding.h"
13 #include "content/network/network_context.h"
14 #include "mojo/public/cpp/bindings/binding_set.h"
15 #include "mojo/public/cpp/bindings/strong_binding_set.h"
16 #include "services/service_manager/public/cpp/binder_registry.h" 13 #include "services/service_manager/public/cpp/binder_registry.h"
17 #include "services/service_manager/public/cpp/service.h" 14 #include "services/service_manager/public/cpp/service.h"
18 15
19 namespace content { 16 namespace content {
20 17
21 class NetworkService : public service_manager::Service, 18 class NetworkService : public service_manager::Service,
22 public mojom::NetworkService { 19 public mojom::NetworkService {
23 public: 20 public:
24 explicit NetworkService( 21 explicit NetworkService(
25 std::unique_ptr<service_manager::BinderRegistry> registry); 22 std::unique_ptr<service_manager::BinderRegistry> registry);
26 ~NetworkService() override; 23 ~NetworkService() override;
27 24
28 private: 25 private:
26 class MojoNetLog;
27
29 // service_manager::Service implementation. 28 // service_manager::Service implementation.
30 void OnBindInterface(const service_manager::BindSourceInfo& source_info, 29 void OnBindInterface(const service_manager::BindSourceInfo& source_info,
31 const std::string& interface_name, 30 const std::string& interface_name,
32 mojo::ScopedMessagePipeHandle interface_pipe) override; 31 mojo::ScopedMessagePipeHandle interface_pipe) override;
33 32
34 void CreateURLLoaderFactory( 33 void Create(const service_manager::BindSourceInfo& source_info,
35 const service_manager::BindSourceInfo& source_info, 34 mojom::NetworkServiceRequest request);
36 mojom::URLLoaderFactoryRequest request);
37 void CreateNetworkService(const service_manager::BindSourceInfo& source_info,
38 mojom::NetworkServiceRequest request);
39 35
40 // mojom::NetworkService implementation: 36 // mojom::NetworkService implementation:
41 void HandleViewCacheRequest(const ResourceRequest& request, 37 void CreateNetworkContext(mojom::NetworkContextRequest request,
42 mojom::URLLoaderClientPtr client) override; 38 mojom::NetworkContextParamsPtr params) override;
39
40 std::unique_ptr<MojoNetLog> net_log_;
43 41
44 std::unique_ptr<service_manager::BinderRegistry> registry_; 42 std::unique_ptr<service_manager::BinderRegistry> registry_;
45 43
46 NetworkContext context_; 44 mojo::Binding<mojom::NetworkService> binding_;
47
48 // Put it below |context_| so that |context_| outlives all the
49 // NetworkServiceURLLoaderFactoryImpl instances.
50 mojo::StrongBindingSet<mojom::URLLoaderFactory> loader_factory_bindings_;
51
52 mojo::BindingSet<mojom::NetworkService> network_service_bindings_;
53 45
54 DISALLOW_COPY_AND_ASSIGN(NetworkService); 46 DISALLOW_COPY_AND_ASSIGN(NetworkService);
55 }; 47 };
56 48
57 } // namespace content 49 } // namespace content
58 50
59 #endif // CONTENT_NETWORK_NETWORK_SERVICE_H_ 51 #endif // CONTENT_NETWORK_NETWORK_SERVICE_H_
OLDNEW
« no previous file with comments | « content/network/network_context.cc ('k') | content/network/network_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698