Prashant Malani | 224d3ca | 2017-03-14 12:44:11 -0700 | [diff] [blame] | 1 | // Copyright 2017 The Chromium OS Authors. All rights reserved. |
| 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
Prashant Malani | d91f489 | 2017-03-22 14:06:44 -0700 | [diff] [blame] | 5 | #include <base/memory/ptr_util.h> |
| 6 | |
Prashant Malani | 224d3ca | 2017-03-14 12:44:11 -0700 | [diff] [blame] | 7 | #include "midis/daemon.h" |
| 8 | |
| 9 | namespace midis { |
| 10 | |
Prashant Malani | f07c952 | 2017-04-11 14:54:29 -0700 | [diff] [blame] | 11 | Daemon::Daemon() |
| 12 | : device_tracker_(base::MakeUnique<DeviceTracker>()), |
| 13 | client_tracker_(base::MakeUnique<ClientTracker>()) {} |
Prashant Malani | 224d3ca | 2017-03-14 12:44:11 -0700 | [diff] [blame] | 14 | |
| 15 | Daemon::~Daemon() {} |
| 16 | |
| 17 | int Daemon::OnInit() { |
| 18 | if (!device_tracker_->InitDeviceTracker()) { |
| 19 | return -1; |
| 20 | } |
| 21 | |
Prashant Malani | f933473 | 2017-04-26 13:06:20 -0700 | [diff] [blame] | 22 | client_tracker_->SetDeviceTracker(device_tracker_.get()); |
Prashant Malani | f07c952 | 2017-04-11 14:54:29 -0700 | [diff] [blame] | 23 | if (!client_tracker_->InitClientTracker()) { |
| 24 | return -1; |
| 25 | } |
| 26 | |
Prashant Malani | 224d3ca | 2017-03-14 12:44:11 -0700 | [diff] [blame] | 27 | return 0; |
| 28 | } |
| 29 | |
| 30 | } // namespace midis |