| 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 : task_runner_(task_runner) {} | 14 URLResponseDiskCacheDelegate* delegate) |
| 15 : task_runner_(task_runner), delegate_(delegate) {} |
| 15 | 16 |
| 16 URLResponseDiskCacheApp::~URLResponseDiskCacheApp() { | 17 URLResponseDiskCacheApp::~URLResponseDiskCacheApp() { |
| 17 } | 18 } |
| 18 | 19 |
| 19 void URLResponseDiskCacheApp::Initialize(ApplicationImpl* app) { | 20 void URLResponseDiskCacheApp::Initialize(ApplicationImpl* app) { |
| 20 base::CommandLine command_line(app->args()); | 21 base::CommandLine command_line(app->args()); |
| 21 bool force_clean = command_line.HasSwitch("clear"); | 22 bool force_clean = command_line.HasSwitch("clear"); |
| 22 db_ = URLResponseDiskCacheImpl::CreateDB(task_runner_, force_clean); | 23 db_ = URLResponseDiskCacheImpl::CreateDB(task_runner_, force_clean); |
| 23 } | 24 } |
| 24 | 25 |
| 25 bool URLResponseDiskCacheApp::ConfigureIncomingConnection( | 26 bool URLResponseDiskCacheApp::ConfigureIncomingConnection( |
| 26 ApplicationConnection* connection) { | 27 ApplicationConnection* connection) { |
| 27 connection->AddService<URLResponseDiskCache>(this); | 28 connection->AddService<URLResponseDiskCache>(this); |
| 28 return true; | 29 return true; |
| 29 } | 30 } |
| 30 | 31 |
| 31 void URLResponseDiskCacheApp::Create( | 32 void URLResponseDiskCacheApp::Create( |
| 32 ApplicationConnection* connection, | 33 ApplicationConnection* connection, |
| 33 InterfaceRequest<URLResponseDiskCache> request) { | 34 InterfaceRequest<URLResponseDiskCache> request) { |
| 34 new URLResponseDiskCacheImpl( | 35 new URLResponseDiskCacheImpl(task_runner_, delegate_, db_, |
| 35 task_runner_, db_, connection->GetRemoteApplicationURL(), request.Pass()); | 36 connection->GetRemoteApplicationURL(), |
| 37 request.Pass()); |
| 36 } | 38 } |
| 37 | 39 |
| 38 } // namespace mojo | 40 } // namespace mojo |
| OLD | NEW |