| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 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 #ifndef COMPONENTS_ARC_VIDEO_ARC_VIDEO_BRIDGE_H | 5 #ifndef COMPONENTS_ARC_VIDEO_ARC_VIDEO_BRIDGE_H_ |
| 6 #define COMPONENTS_ARC_VIDEO_ARC_VIDEO_BRIDGE_H | 6 #define COMPONENTS_ARC_VIDEO_ARC_VIDEO_BRIDGE_H_ |
| 7 | 7 |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "components/arc/arc_bridge_service.h" | 10 #include "components/arc/arc_bridge_service.h" |
| 11 #include "components/arc/arc_service.h" |
| 11 #include "components/arc/video/video_host_delegate.h" | 12 #include "components/arc/video/video_host_delegate.h" |
| 12 #include "mojo/public/cpp/bindings/binding.h" | 13 #include "mojo/public/cpp/bindings/binding.h" |
| 13 | 14 |
| 14 namespace arc { | 15 namespace arc { |
| 15 | 16 |
| 16 class VideoHostDelegate; | 17 class VideoHostDelegate; |
| 17 | 18 |
| 18 // ArcVideoBridge bridges ArcBridgeService and VideoHostDelegate. It observes | 19 // ArcVideoBridge bridges ArcBridgeService and VideoHostDelegate. It observes |
| 19 // ArcBridgeService events and pass VideoHost proxy to VideoInstance. | 20 // ArcBridgeService events and pass VideoHost proxy to VideoInstance. |
| 20 class ArcVideoBridge : public ArcBridgeService::Observer { | 21 class ArcVideoBridge : public ArcService, public ArcBridgeService::Observer { |
| 21 public: | 22 public: |
| 22 explicit ArcVideoBridge(scoped_ptr<VideoHostDelegate> video_host_delegate); | 23 ArcVideoBridge(ArcBridgeService* bridge_service, |
| 24 scoped_ptr<VideoHostDelegate> video_host_delegate); |
| 23 ~ArcVideoBridge() override; | 25 ~ArcVideoBridge() override; |
| 24 | 26 |
| 25 // Starts listening to state changes of the ArcBridgeService. | |
| 26 void StartObservingBridgeServiceChanges(); | |
| 27 | |
| 28 // arc::ArcBridgeService::Observer implementation. | 27 // arc::ArcBridgeService::Observer implementation. |
| 29 void OnStateChanged(arc::ArcBridgeService::State state) override; | 28 void OnStateChanged(arc::ArcBridgeService::State state) override; |
| 30 void OnVideoInstanceReady() override; | 29 void OnVideoInstanceReady() override; |
| 31 | 30 |
| 32 private: | 31 private: |
| 32 ArcBridgeService* const arc_bridge_service_; // owned by ArcServiceManager. |
| 33 |
| 33 scoped_ptr<VideoHostDelegate> video_host_delegate_; | 34 scoped_ptr<VideoHostDelegate> video_host_delegate_; |
| 34 mojo::Binding<arc::VideoHost> binding_; | 35 mojo::Binding<arc::VideoHost> binding_; |
| 35 | 36 |
| 36 DISALLOW_COPY_AND_ASSIGN(ArcVideoBridge); | 37 DISALLOW_COPY_AND_ASSIGN(ArcVideoBridge); |
| 37 }; | 38 }; |
| 38 | 39 |
| 39 } // namespace arc | 40 } // namespace arc |
| 40 | 41 |
| 41 #endif // COMPONENTS_ARC_VIDEO_ARC_VIDEO_BRIDGE_H | 42 #endif // COMPONENTS_ARC_VIDEO_ARC_VIDEO_BRIDGE_H_ |
| OLD | NEW |