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

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

Issue 2870203002: Implement chrome://view-http-cache with network service. (Closed)
Patch Set: fix memory leak 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
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/cache_url_loader.h"
9 #include "content/network/network_service_url_loader_factory_impl.h" 10 #include "content/network/network_service_url_loader_factory_impl.h"
10 #include "services/service_manager/public/cpp/bind_source_info.h" 11 #include "services/service_manager/public/cpp/bind_source_info.h"
11 12
12 namespace content { 13 namespace content {
13 14
14 NetworkService::NetworkService( 15 NetworkService::NetworkService(
15 std::unique_ptr<service_manager::BinderRegistry> registry) 16 std::unique_ptr<service_manager::BinderRegistry> registry)
16 : registry_(std::move(registry)) { 17 : registry_(std::move(registry)) {
17 registry_->AddInterface<mojom::URLLoaderFactory>( 18 registry_->AddInterface<mojom::URLLoaderFactory>(base::Bind(
18 base::Bind(&NetworkService::Create, base::Unretained(this))); 19 &NetworkService::CreateURLLoaderFactory, base::Unretained(this)));
20 registry_->AddInterface<mojom::NetworkService>(base::Bind(
21 &NetworkService::CreateNetworkService, base::Unretained(this)));
19 } 22 }
20 23
21 NetworkService::~NetworkService() = default; 24 NetworkService::~NetworkService() = default;
22 25
23 void NetworkService::OnBindInterface( 26 void NetworkService::OnBindInterface(
24 const service_manager::BindSourceInfo& source_info, 27 const service_manager::BindSourceInfo& source_info,
25 const std::string& interface_name, 28 const std::string& interface_name,
26 mojo::ScopedMessagePipeHandle interface_pipe) { 29 mojo::ScopedMessagePipeHandle interface_pipe) {
27 registry_->BindInterface(source_info, interface_name, 30 registry_->BindInterface(source_info, interface_name,
28 std::move(interface_pipe)); 31 std::move(interface_pipe));
29 } 32 }
30 33
31 void NetworkService::Create(const service_manager::BindSourceInfo& source_info, 34 void NetworkService::CreateURLLoaderFactory(
32 mojom::URLLoaderFactoryRequest request) { 35 const service_manager::BindSourceInfo& source_info,
36 mojom::URLLoaderFactoryRequest request) {
33 loader_factory_bindings_.AddBinding( 37 loader_factory_bindings_.AddBinding(
34 base::MakeUnique<NetworkServiceURLLoaderFactoryImpl>(&context_), 38 base::MakeUnique<NetworkServiceURLLoaderFactoryImpl>(&context_),
35 std::move(request)); 39 std::move(request));
36 } 40 }
37 41
42 void NetworkService::CreateNetworkService(
43 const service_manager::BindSourceInfo& source_info,
44 mojom::NetworkServiceRequest request) {
45 network_service_bindings_.AddBinding(this, std::move(request));
46 }
47
48 void NetworkService::HandleViewCacheRequest(const ResourceRequest& request,
49 mojom::URLLoaderClientPtr client) {
50 StartCacheURLLoader(request, context_.url_request_context(),
51 std::move(client));
52 }
53
38 } // namespace content 54 } // 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