OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "services/url_response_disk_cache/url_response_disk_cache_app.h" | 5 #include "services/url_response_disk_cache/url_response_disk_cache_app.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "services/url_response_disk_cache/url_response_disk_cache_impl.h" | 8 #include "services/url_response_disk_cache/url_response_disk_cache_impl.h" |
9 | 9 |
10 namespace mojo { | 10 namespace mojo { |
11 | 11 |
12 URLResponseDiskCacheApp::URLResponseDiskCacheApp( | 12 URLResponseDiskCacheApp::URLResponseDiskCacheApp( |
13 scoped_refptr<base::TaskRunner> task_runner, | 13 scoped_refptr<base::TaskRunner> task_runner, |
14 URLResponseDiskCacheDelegate* delegate) | 14 URLResponseDiskCacheDelegate* delegate) |
15 : task_runner_(task_runner), delegate_(delegate) {} | 15 : task_runner_(task_runner), delegate_(delegate) {} |
16 | 16 |
17 URLResponseDiskCacheApp::~URLResponseDiskCacheApp() { | 17 URLResponseDiskCacheApp::~URLResponseDiskCacheApp() { |
18 } | 18 } |
19 | 19 |
20 void URLResponseDiskCacheApp::Initialize(ApplicationImpl* app) { | 20 void URLResponseDiskCacheApp::Initialize(ApplicationImpl* app) { |
21 base::CommandLine command_line(app->args()); | 21 base::CommandLine command_line(app->args()); |
22 bool force_clean = command_line.HasSwitch("clear"); | 22 bool force_clean = command_line.HasSwitch("clear"); |
23 db_ = URLResponseDiskCacheImpl::CreateDB(task_runner_, force_clean); | 23 db_ = URLResponseDiskCacheImpl::CreateDB(task_runner_, force_clean); |
24 } | 24 } |
25 | 25 |
26 bool URLResponseDiskCacheApp::ConfigureIncomingConnection( | 26 bool URLResponseDiskCacheApp::ConfigureIncomingConnection( |
27 ApplicationConnection* connection) { | 27 ApplicationConnection* connection) { |
28 connection->AddService<URLResponseDiskCache>(this); | 28 connection->GetServiceProviderImpl().AddService<URLResponseDiskCache>([this]( |
| 29 const ConnectionContext& connection_context, |
| 30 InterfaceRequest<URLResponseDiskCache> request) { |
| 31 new URLResponseDiskCacheImpl(task_runner_, delegate_, db_, |
| 32 connection_context.remote_url, request.Pass()); |
| 33 }); |
29 return true; | 34 return true; |
30 } | 35 } |
31 | 36 |
32 void URLResponseDiskCacheApp::Create( | |
33 const ConnectionContext& connection_context, | |
34 InterfaceRequest<URLResponseDiskCache> request) { | |
35 new URLResponseDiskCacheImpl(task_runner_, delegate_, db_, | |
36 connection_context.remote_url, request.Pass()); | |
37 } | |
38 | |
39 } // namespace mojo | 37 } // namespace mojo |
OLD | NEW |