lhchavez | 811769b | 2016-01-21 23:27:25 | [diff] [blame] | 1 | // Copyright 2016 The Chromium 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 | |
| 5 | #ifndef COMPONENTS_ARC_ARC_SERVICE_H_ |
| 6 | #define COMPONENTS_ARC_ARC_SERVICE_H_ |
| 7 | |
| 8 | #include "base/macros.h" |
| 9 | |
| 10 | namespace arc { |
| 11 | |
| 12 | class ArcBridgeService; |
| 13 | |
| 14 | // Abstract class whose lifecycle will be managed by the ArcServiceManager. It |
| 15 | // is guaranteed that once the ownership of an ArcService has been transferred |
| 16 | // to ArcServiceManager, it will outlive the ArcBridgeService, so it is safe to |
| 17 | // keep a weak reference to it. |
| 18 | class ArcService { |
| 19 | public: |
| 20 | virtual ~ArcService(); |
| 21 | |
| 22 | ArcBridgeService* arc_bridge_service() const { return arc_bridge_service_; } |
| 23 | |
| 24 | protected: |
| 25 | explicit ArcService(ArcBridgeService* arc_bridge_service); |
| 26 | |
| 27 | private: |
| 28 | ArcBridgeService* const arc_bridge_service_; // owned by ArcServiceManager. |
| 29 | |
| 30 | DISALLOW_COPY_AND_ASSIGN(ArcService); |
| 31 | }; |
| 32 | |
| 33 | } // namespace arc |
| 34 | |
| 35 | #endif // COMPONENTS_ARC_ARC_SERVICE_H_ |