| 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 "mojo/public/cpp/application/service_provider_impl.h" |
| 8 #include "services/url_response_disk_cache/url_response_disk_cache_impl.h" | 9 #include "services/url_response_disk_cache/url_response_disk_cache_impl.h" |
| 9 | 10 |
| 10 namespace mojo { | 11 namespace mojo { |
| 11 | 12 |
| 12 URLResponseDiskCacheApp::URLResponseDiskCacheApp( | 13 URLResponseDiskCacheApp::URLResponseDiskCacheApp( |
| 13 scoped_refptr<base::TaskRunner> task_runner, | 14 scoped_refptr<base::TaskRunner> task_runner, |
| 14 URLResponseDiskCacheDelegate* delegate) | 15 URLResponseDiskCacheDelegate* delegate) |
| 15 : task_runner_(task_runner), delegate_(delegate) {} | 16 : task_runner_(task_runner), delegate_(delegate) {} |
| 16 | 17 |
| 17 URLResponseDiskCacheApp::~URLResponseDiskCacheApp() { | 18 URLResponseDiskCacheApp::~URLResponseDiskCacheApp() {} |
| 18 } | |
| 19 | 19 |
| 20 void URLResponseDiskCacheApp::Initialize(ApplicationImpl* app) { | 20 void URLResponseDiskCacheApp::OnInitialize() { |
| 21 base::CommandLine command_line(app->args()); | 21 base::CommandLine command_line(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::OnAcceptConnection( |
| 27 ServiceProviderImpl* service_provider_impl) { | 27 ServiceProviderImpl* service_provider_impl) { |
| 28 service_provider_impl->AddService<URLResponseDiskCache>([this]( | 28 service_provider_impl->AddService<URLResponseDiskCache>([this]( |
| 29 const ConnectionContext& connection_context, | 29 const ConnectionContext& connection_context, |
| 30 InterfaceRequest<URLResponseDiskCache> request) { | 30 InterfaceRequest<URLResponseDiskCache> request) { |
| 31 new URLResponseDiskCacheImpl(task_runner_, delegate_, db_, | 31 new URLResponseDiskCacheImpl(task_runner_, delegate_, db_, |
| 32 connection_context.remote_url, request.Pass()); | 32 connection_context.remote_url, request.Pass()); |
| 33 }); | 33 }); |
| 34 return true; | 34 return true; |
| 35 } | 35 } |
| 36 | 36 |
| 37 } // namespace mojo | 37 } // namespace mojo |
| OLD | NEW |