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