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

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

Issue 2837813004: Sync the browser test host resolver with the network process before a test runs. (Closed)
Patch Set: review comments Created 3 years, 8 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
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 #include "content/network/network_service.h" 5 #include "content/network/network_service.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/memory/ptr_util.h" 8 #include "base/memory/ptr_util.h"
9 #include "content/network/network_service_url_loader_factory_impl.h" 9 #include "content/network/network_service_url_loader_factory_impl.h"
10 #include "services/service_manager/public/cpp/service_info.h" 10 #include "services/service_manager/public/cpp/service_info.h"
11 11
12 namespace content { 12 namespace content {
13 13
14 NetworkService::NetworkService() { 14 NetworkService::NetworkService(
15 registry_.AddInterface<mojom::URLLoaderFactory>(this); 15 std::unique_ptr<service_manager::BinderRegistry> registry)
16 : registry_(std::move(registry)) {
17 registry_->AddInterface<mojom::URLLoaderFactory>(this);
16 } 18 }
17 19
18 NetworkService::~NetworkService() = default; 20 NetworkService::~NetworkService() = default;
19 21
20 // static
21 std::unique_ptr<service_manager::Service>
22 NetworkService::CreateNetworkService() {
23 return base::MakeUnique<NetworkService>();
24 }
25
26 void NetworkService::OnBindInterface( 22 void NetworkService::OnBindInterface(
27 const service_manager::ServiceInfo& source_info, 23 const service_manager::ServiceInfo& source_info,
28 const std::string& interface_name, 24 const std::string& interface_name,
29 mojo::ScopedMessagePipeHandle interface_pipe) { 25 mojo::ScopedMessagePipeHandle interface_pipe) {
30 registry_.BindInterface(source_info.identity, interface_name, 26 registry_->BindInterface(source_info.identity, interface_name,
31 std::move(interface_pipe)); 27 std::move(interface_pipe));
32 } 28 }
33 29
34 void NetworkService::Create(const service_manager::Identity& remote_identity, 30 void NetworkService::Create(const service_manager::Identity& remote_identity,
35 mojom::URLLoaderFactoryRequest request) { 31 mojom::URLLoaderFactoryRequest request) {
36 loader_factory_bindings_.AddBinding( 32 loader_factory_bindings_.AddBinding(
37 base::MakeUnique<NetworkServiceURLLoaderFactoryImpl>(&context_), 33 base::MakeUnique<NetworkServiceURLLoaderFactoryImpl>(&context_),
38 std::move(request)); 34 std::move(request));
39 } 35 }
40 36
41 } // namespace content 37 } // namespace content
OLDNEW
« no previous file with comments | « content/network/network_service.h ('k') | content/public/app/mojo/content_browser_manifest.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698